I've met this warning messages from Tornado 1 "xxx.c : warning: 1
trigraph(s) encountered"
I don't know the meaning of this warning... -_-;
please, let me know the meaning and solution..
thanks for reading and have a nice day...
> I've met this warning messages from Tornado 1 "xxx.c : warning: 1
> trigraph(s) encountered"
>
> I don't know the meaning of this warning... -_-;
As it says in the GNU Toolkit manual (or the gcc info pages), trigraphs
are ANSI C's horrible method for handling systems that do not have all
the C special characters. Instead combinations of 3 characters are used,
so %%/ might mean \ (I don't know for certain!)
GCC is aware that most people don't use trigraphs, so it warns you that
you have entered one. You may find that the code in xxx.c behaves
slightly unexpectedly, as some of what the compiler saw does not match
what you think you typed.
In this case ANSI C - try K&R 2.
Trigraphs are horrid beasts invented by the ANSI C committe way back in the
mid 1980s in order to make C source readable on terminals/printers with
non-US/UK 7-bit character sets. In particular those where [ ] ^ \ { } ` etc
are accented characters rather than punctuation.
Any sequence ??x (in C source) is replaced by a single other character.
I don't know the mappings, but suspect:
??( is [
??/ is \
there are about a dozen of them.
You probably have ??? in a string somewhere...
(you can subvert things by concatenating strings - "abc" "def" is identical
to "abcdef")
Trigraphs are thus valid C - but almost certainly not what you had in mind.
David
최창식 <csc...@etri.re.kr> wrote in message
news:96vgsv$h40$1...@news.etri.re.kr...
I'm pretty sure that Gcc *ignores* them by default, and the warning is to
let you know that if by any remote chance you *did* want a trigraph, you
have to use the -trigraphs switch to enable them. So there's no need to
concatenate strings to avoid them, unless portability to very old compilers
is an issue for you! You could probably add -Wno-trigraphs to your build
flags.
DaveK
--
They laughed at Galileo. They laughed at Copernicus. They laughed at
Columbus. But remember, they also laughed at Bozo the Clown.
printf("What??!");
to
printf("What?\?!");
for code you need to give other people to compile (that do not have/want to
set -Wno-trgraph thing)
and maybe more 'beautiful' than string concatenation...
hth
werner
Dave Korn <no....@my.mailbox.invalid> wrote in message
news:eH7l6.517$yi4.4...@newsr1.u-net.net...
Kris
"Simon Farnsworth" <simon.fa...@snellwilcox.com> wrote in message
news:3A938FB6...@snellwilcox.com...
Trigraphs still count in comments because any character you might want to
put in your code but don't have a key for is also a character you might want
to put in a comment but not have a key for.
If it soes not change the effect of a program (if compiled with a system
that does trigraph conversion) I would agree with that.
But for the rest of possible occurences I think it makes sense.
Just take my favorite example:
printf("What??!");
I think it is better to have a warning and learn about the problem than one
day finding the program misbehaving because it is compiled on an other
system or compiler.
Just my 2 cent
werner
your post is perfectly clear to me now and probably it's my fault to skip
that informtion in your post...
however it is clear to anyone else now as well, i guess :-)
btw: i think the trigraph replacement is done as one of the first things,
even before macro expansion
the compiler proper does not even see them, so the warning is produced by
the preprocessor (afaik...)
regards
werner
Bill Pringlemeir <bpring...@yahoo.com> wrote in message
news:ud7c5c...@yahoo.com...
>
> >> Bill Pringlemeir wrote:
> >> Well, obviously they count. However, is it productive for GCC to
> >> give a warning? I don't think so.
>
> >>>>> "Werner" == Werner Schiendl <ws-...@gmx.at> writes:
>
> Werner> If it soes not change the effect of a program (if compiled
> Werner> with a system that does trigraph conversion) I would agree
> Werner> with that. But for the rest of possible occurences I think
> Werner> it makes sense.
>
> Werner> Just take my favorite example: printf("What??!");
>
> Werner> I think it is better to have a warning and learn about the
> Werner> problem than one day finding the program misbehaving because
> Werner> it is compiled on an other system or compiler.
>
> I don't think that you read my entire message or my meaning was
> unclear! The compiler shouldn't give a warning in code that is not
> producing anything. Like comments and unused conditional. What you
> did quote was quite out of context.
>
> Obviously, printf("What??!"); by itself would be a good place to warn.
> However some constructs wouldn't be. Surely this one isn't needed,
>
> /* What??! */
>
> And cases like this are somewhat questionable to warn of...
>
> #if 0
> printf("What??!")
> #endif
>
> The compiler wouldn't warn of a missing semi-colon, but it would warn
> of the trigraph. Obviously this warning is being done by the
> preprocessor. It has information as to what a comment is and what
> conditions are active.
>
> Is my meaning clear now?
>
> regards,
> Bill Pringlemeir
>
> --
> Useful vxWorks URLS,
> "http://www.xs4all.nl/~borkhuis/vxworks/vxworks.html"
> "http://www.xs4all.nl/~borkhuis/vxworks/vxw_pt9.html"
But what if you used the following line (so without the spaces):
/*What??/*/
For GCC this would be correct, but according to an earlier post the
sequence "??/" means "\" if interpreted as a trigraph. So this would be
seen to a compiler that recognises trigraphs as:
/* What\*/
and this is an illegal statement.
So in my opinion GCC is correct to warn, because the code you are using is
not very portable.
Groeten,
Johan
--
o o o o o o o . . . _____________________________
o _____ || Johan Borkhuis |
.][__n_n_|DD[ ====_____ | bork...@agere.com |
>(________|__|_[_________]_|__________________________|
_/oo OOOOO oo` ooo ooo 'o!o!o o!o!o`
=== VxWorks FAQ: http://www.xs4all.nl/~borkhuis/vxworks/vxworks.html ===