please tell me how can i find that it is legal or illegal char initialization.I have read from the book is that char can be assigned value '\uxxxx'.And xxxx stands for hexadecimal digit.But '\u000a' is not legal .WHY?
The compiler translates unicode characters at the beginning of the compile cycle. You cannot use the character literals \u000a(newline) or \u000d(carriage return) in char literals or string literals as they will be interpreted as line terminator not as input characters. Instead always use special characters '\n' or '\r'
"Control time instead of letting time control you."
Because Unicode escapes are processed very early, it is not correct to write '\u000a' for a character literal whose value is linefeed (LF); the Unicode escape \u000a is transformed into an actual linefeed in translation step 1 (�3.3) and the linefeed becomes a LineTerminator in step 2 (�3.4), and so the character literal is not valid in step 3. Instead, one should use the escape sequence '\n' (�3.10.6). Similarly, it is not correct to write '\u000d' for a character literal whose value is carriage return (CR). Instead, use '\r'.
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer sscce.org
Joined: Oct 23, 2007
Thanks Mr.Prasun Howlader and Mr.marc weber . If you know other limitations other than '\u000a','\u000d',\u005c' ,'\0027' ,which we can not use in assigning a char literal,Please tell me if others are present
[ January 06, 2008: Message edited by: pradeep singh ] [ January 06, 2008: Message edited by: pradeep singh ]
subject: I am now totally confused about using char literal.Please help me.