3 ms·
Yeah, life sucks. There's no good solution to all that. The approach used for new keywords is to use lots of '__' on one end or the other. Anybody that used va
by JoeAltmaier 12y ago
Yeah, life sucks. There's no good solution to all that.
The approach used for new keywords is to use lots of '__' on one end or the other. Anybody that used variables with those names was asking for trouble. Yet, then, the new keywords look like crap. Nobody wins.
My favorite, years ago, was the usage in the normal C header files in Linux of a linked-list variable with the name 'new'. It was obvious that nobody in Linux-land had ever compiled a C++ program.
- cygx 12y agoNew C keywords now use a leading underscore (_Atomic, _Bool, _Static_assert, ...) and come with a header file you can include to get a more friendly name (stdbool.h, stdatomic.h, assert.h, ....). As to not keeping your C code C++ clean: Just use a dedicated C compiler and link the object files.
- JoeAltmaier 12y agoThen what header files do you compile your C++ with? That's all there was at the time.
- cygx 12y agoIf it occurs in public header files or if you use C++ keywords as external symbols, that is indeed a bit... inconsiderate, to say the least. Header files intended for public comsumption should stick to the intersection of C and C++ in most cases.