Octal literals, warning pragmas, and \x escapes
Chapter 7: Concluding C# 2: the final features: 7.5.1
Last updated: 2/24/2008
Eric doesn't like lines such as
#pragma warning disable 0169 - they provoke comments like this:
C# does not have octal literals, thank goodness, but this still gives me cognitive dissonance to look at. It reminds me too much of the painfully broken rules in Jscript for dealing with literals in this form...
I completely agree that it's a good thing that C# doesn't have octal literals. However, it does have the awful
\x escape sequences for Unicode characters. Think fast - what's the difference between
"I say:\x8Good compiler" and
"You say:\x8Bad compiler"? Does one include "Good compiler" and the other include "Bad compiler" in its output? No - because while "G" isn't a valid hex digit, all the characters in "Bad" are. The two literals are the same as :
"I say:\u0008Good compiler" and
"You say:\u8BAD compiler" - but here the difference is much more obvious.