Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!usc!rutgers!mcnc!uvaarpa!murdoch!news From: mms7r@krebs.acc.Virginia.EDU (Mitch Smith) Newsgroups: comp.unix.aix Subject: Bogus warning from AIX XL C Compiler/6000? Message-ID: <1990Aug23.034343.11444@murdoch.acc.Virginia.EDU> Date: 23 Aug 90 03:43:43 GMT Sender: news@murdoch.acc.Virginia.EDU Organization: University of Virginia Lines: 50 System: RS/6000 Model 530 AIX 3.1 AIX XL C Compiler/6000 Problem: The character constant in the following short program produces a bogus warning. /* test1.c */ main() { int c; c = '\x'; printf("c = %c\n", c); exit(0); } The output of the compiler invoked as "cc" is as follows: $ make test1 cc -O test1.c -o test1 5 | c = '\x'; ..............a.. a - 1506-235: (W) Illegal escape sequence x ignored. $ In fact, 'x' is not ignored. When executed, the compiled program prints "c = x". The program above compiles without errors or warnings on an AT&T 3B15, an SGI IRIS 3030, a MicroVAXII BSD4.3, a MIPS M/120, an SGI IRIS 4D/310, and an IBM-PC with Microsoft C 5.1. According to K&R (1978), page 181, under the section on character constants: "If the character following a backslash is not one of those specified, the backslash is ignored." [The "specified" escape sequences being '\n', '\t', etc.] Thus, the escape sequence should not be illegal, and if the warning message is going to print anything it should be the backslash that should be ignored. Has this behavior been outlawed by a recent Standard? Mitch Smith Department of Microbiology mms7r@virginia.edu University of Virginia ...!{uunet,mcnc}!virginia!mms7r Charlottesville, VA 22908 (804) 924-2669