Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!um-math!sharkey!mcf!elsie!ado From: ado@elsie.UUCP (Arthur David Olson) Newsgroups: comp.lang.c Subject: Re: Dumb question: What IS a trigraph? Message-ID: <9130@elsie.UUCP> Date: 19 Aug 89 00:32:23 GMT References: <3566@uwovax.uwo.ca> <5940008@hpcupt1.HP.COM> Organization: NIH-LEC, Bethesda, MD Lines: 39 In article <5940008@hpcupt1.HP.COM>, swh@hpcupt1.HP.COM (Steve Harrold) writes: > . . .say you have a string literal in your code. . .like > "...Are you sure you want to do this??.....". The. . .two question marks > will cause the Ansi-conformant compiler to hunt for a trigraph. > If the character immediately following the "??" completes > a legal trigraph, your string is no longer what you thought it was. > > The compilation will succeed without comment, but your run-time results > may vary. Script started on Fri Aug 18 20:26:28 1989 elsie$ cat try.c #includeint main(argc, argv) int argc; char * argv[]; { (void) printf("Hello, world??!\n"); return 0; } elsie$ /usr/local/bin/gcc try.c elsie$ a.out Hello, world??! elsie$ /usr/local/bin/gcc -trigraphs try.c elsie$ a.out Hello, world| elsie$ /usr/local/bin/gcc -trigraphs -Wtrigraphs try.c >>>> try.c:1: warning: file contains 1 trigraph(s) elsie$ a.out Hello, world| elsie$ exit script done on Fri Aug 18 20:27:01 1989 The compilation will not *necessarily* succeed without comment. -- Arthur David Olson ado@alw.nih.gov ADO is a trademark of Ampex.