C++ multicharacter literal -


i didn't know c , c++ allow multicharacter literal: not 'c' (of type int in c , char in c++), 'tralivali' (of type int!)

enum {     actionleft = 'left',     actionright = 'right',     actionforward = 'forward',     actionbackward = 'backward' }; 

standard says:

c99 6.4.4.4p10: "the value of integer character constant containing more 1 character (e.g., 'ab'), or containing character or escape sequence not map single-byte execution character, implementation-defined."

i found used in c4 engine. suppose not safe when talking platform-independend serialization. thay can confusing because strings. multicharacter literal's scope of usage, useful something? in c++ compatibility c code? considered bad feature goto operator or not?

i don't know how extensively used, "implementation-defined" big red-flag me. far know, mean implementation choose ignore character designations , assign normal incrementing values if wanted. may "nicer", can't rely on behavior across compilers (or compiler versions). @ least "goto" has predictable (if undesirable) behavior...

that's 2c, anyway.

edit: on "implementation-defined":

from bjarne stroustrup's c++ glossary:

implementation defined - aspect of c++'s semantics defined each implementation rather specified in standard every implementation. example size of int (which must @ least 16 bits can longer). avoid implementation defined behavior whenever possible. see also: undefined. tc++pl c.2.

also...

undefined - aspect of c++'s semantics no reasonable behavior required. example dereferencing pointer value zero. avoid undefined behavior. see also: implementation defined. tc++pl c.2.

i believe means comment correct: should @ least compile, although beyond not specified. note advice in definition, also.


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -