Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8924929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T07:33:30+00:00 2026-06-15T07:33:30+00:00

Even in the GCC Compilers, the trigraphs are not getting compiled without explicitly specifying

  • 0

Screen Shot of the Program with trigraphs compiled using Turbo C++

Even in the GCC Compilers, the trigraphs are not getting compiled without explicitly specifying the trigraph attribute.

#include<stdio.h>

int main()
 {
 int a=4;
 if((a==4) ??! (a==5))
   printf("\nHello world!");
 return 0;
 }

This program saved as try.c gets compiled in GCC Compiler only when we specify gcc -Wall -trigraphs try.c and it still shows warnings.
Can you enlist some compilers that will treat and handle trigraphs without any errors or warnings?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T07:33:32+00:00Added an answer on June 15, 2026 at 7:33 am

    Trigraphs were introduced by the 1989 ANSI C standard, and are retained in all later C standards (so far; the upcoming C23 standard will drop them). They also appear in the first ISO C++ standard, published in 1998, and in all later C++ standards up to and including C++14. (Trigraphs were removed in C++17. Thanks to Jonathan Leffler and dyp for tracking down the details.)

    Quoting a draft of the C++17 standard:

    Effect on original feature: Valid C ++ 2014 code that uses trigraphs
    may not be valid or may have different semantics in this International
    Standard. Implementations may choose to translate trigraphs as
    specified in C ++ 2014 if they appear outside of a raw string literal,
    as part of the implementation-defined mapping from physical source
    file characters to the basic source character set.

    They are not an optional feature in either language (prior to C++17); all conforming compilers must support them and interpret them as specified by the respective language standard.

    For example, if this program:

    #include <stdio.h>
    int main(void) {
        if ('|' == '??!') {
            puts("ok");
        }
        else {
            puts("oops");
        }
        return 0;
    }
    

    prints oops, then your compiler is non-conforming.

    But many, perhaps most, C compilers are not fully conforming by default. As long as a compiler can be made to conform to the standard in some way, that’s good enough as far as the standard is concerned. (gcc requires -pedantic and -std=... to do this.)

    But even if a compiler is fully conforming, there’s nothing in the standard that forbids a compiler from warning about anything it likes. A conforming C compiler must diagnose any violation of a syntax rule or constraint, but it can issue as many additional warnings as it likes — and it needn’t distinguish between required diagnostics and other warnings.

    Trigraphs are very rarely used. The vast majority of development systems support directly all the characters for which trigraphs substitute: #, [, \, ], ^, {, |, }, ~.

    In fact, it’s likely that trigraphs are used accidentally more often than they’re used correctly:

    fprintf(stderr, "What just happened here??!\n");
    

    Warning about trigraphs that might alter the meaning of a program (relative to the meaning it would have if the language didn’t have trigraphs) is both permitted by the ISO standard and IMHO perfectly reasonable. Most compilers probably have options to turn off such warnings.

    Conversely, for a C++17 compiler that doesn’t implement trigraphs, it would be reasonable to warn about sequences that would have been treated as trigraphs in C++14 or earlier, and/or to provide an option to support trigraphs. Again, an option to disable such warnings would be a good thing.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Even without a printer-friendly view to print directions, when I choose File->Print in my
Even though it's not part of HTTP 1.1/RFC2616 webapps that wish to force a
How universally is the C99 standard supported in today's compilers? I understand that not
gcc will warn about the following example code: struct someStruct { char c; int
Is it possible to tell GCC to use warn_unused_result flag for all function even
I'm getting the following error: ld.exe||cannot find -lD:\Libraries\boost_1_47_0\boost_1_47_0\stage\lib| Even though the path is valid.
Even .head doesn't work. What changes do I need to make to make this
Even if I appointed id and a class to an img tag of the
Even Stack Overflow doesn't compress their HTML . Is it recommended to compress HTML?
Even I used break() and exit() statements many times, I am bit confused between

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.