#Ansi Codes from 'C'
04-Sep-90 02:28:33
Sb: #118972-#Ansi Codes from 'C'
Fm: Don Curtis/SYSOP 76703,4321
To: Mike Spille/Manx 71545,1466
Mike,
Yes, to the best of my knowledge, octal constants are always 8 bits
and checking K&R (2nd Edition) the escape may be followed by 1, 2 or 3
octal digits (it doesn't say may *only* be followed, but that's implied).
However, when dealing with hex it states that there is no limit on the
number of digits, but the behavior is undefined if the resulting character
value exceeds that of the largest character.
Trying this little test in Lattice 5.05:
main()
{
printf("\0330\n");
printf("\x1b0\n");
}
generates a warning about a hex constant being too large for char
but generates no warning about the octal string. However, looking at the
output…both printf()s generate the same string of an escape followed by
the character "0" and a newline.
Don