Douglas Alan wrote:
On Aug 11, 2:00 pm, Steven D'Aprano <st...@remove-this-
cybersource.com.au> wrote:


test.cpp:1:1: warning: unknown escape sequence '\y'

Isn't that a warning, not a fatal error? So what does temp contain?


My "Annotated C++ Reference Manual" is packed, and surprisingly in
Stroustrup's Third Edition, there is no mention of the issue in the
entire 1,000 pages. But Microsoft to the rescue:

     If you want a backslash character to appear within a string,
     you must type two backslashes (\\)

(From http://msdn.microsoft.com/en-us/library/69ze775t.aspx)

The question of what any specific C++ does if you ignore the warning
is irrelevant, as such behavior in C++ is almost *always* undefined.
Hence the warning.

|>ouglas

Almost always undefined? Whereas with Python, and some memorization or a small table/list nearby, you can easily *know* what you will get.

Mind you, I'm not really vested in how Python *should* handle backslashes one way or the other, but I am glad it has rules that it follows for consitent results, and I don't have to break out a byte-code editor to find out what's in my string literal.

~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to