trigraph ??/ ignored, use -trigraphs to enable
Asked Answered
S

2

17

My compiler (gcc) is giving me this warning. Please help me to understand what it means:

warning: trigraph ??/ ignored, use -trigraphs to enable

Siberia answered 8/12, 2011 at 17:55 Comment(3)
??/ is the equivalent of backslash, you can replace the triagraph to "\"Privative
Unless you're (say) editing C code on a mainframe 3270 terminal, or so forth, it's a "good idea" to write an occurrence of "??" as "?\?", for paranoia's sake. (Some characters, like {} [] \, are absent in many mainframe character sets, as well as some non-English keyboards for other systems.)Usable
The dusty corners of C strike again...Intrust
A
18

You have "accidentally" written a trigraph somewhere in your source code (the compiler's warning would pinpoint the line). Since trigraphs were invented to solve a problem that doesn't come into play on modern systems, you don't actually want the trigraph ??/ to be replaced with the character \.

Therefore, this warning should probably be ignored (you can tell the compiler to shut up by adding -Wno-trigraphs after -Wall in your command line; see the docs). But it would be good to show your source code so we can be sure.

Arachnoid answered 8/12, 2011 at 17:59 Comment(0)
H
17

Instead of adding a compiler flag, you could just escape each question mark with \, i.e. \?\?-. This helped in my case.

Hazlett answered 20/12, 2013 at 18:55 Comment(1)
Compiler flag is supposed for cases where you write a trigraph without noticing it is one. Then compiler will not annoy you about it. If you knew at the time of writing that it is an unintended trigraph, then you could escape it as you suggested and forget compiler flags.Paginal

© 2022 - 2024 — McMap. All rights reserved.