Bogus warning from AIX XL C Compiler/6000?
Mitch Smith
mms7r at krebs.acc.Virginia.EDU
Thu Aug 23 13:43:43 AEST 1990
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 at virginia.edu
University of Virginia ...!{uunet,mcnc}!virginia!mms7r
Charlottesville, VA 22908 (804) 924-2669
More information about the Comp.unix.aix
mailing list