Dumb question: What IS a trigraph?

Arthur David Olson ado at elsie.UUCP
Sat Aug 19 10:32:23 AEST 1989


In article <5940008 at hpcupt1.HP.COM>, swh at 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
	#include <stdio.h>

	int
	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 at alw.nih.gov    ADO is a trademark of Ampex.



More information about the Comp.lang.c mailing list