Quote:
Originally Posted by rubadub
to help alter all the zillions of lines of code, have a look at awk and grep.
Then look at this and this, but maybe you should just do your own typedef for all you variables in a single header. This could then simply be regenerated for whatever compiler it's being compiled upon. Are you totally ANSI compliant?
|
Thanks. Yes, I've seen those references before, and dozens of others - not counting all the header files I've looked through (though the combinatorial explosion of conditional [pre-processor] statements often prevents me from being certain which of many situations apply).
I have no idea whether my code is ANSI compliant! Perhaps I should find out, and probably I should order a couple good/simple/concise C and C++ books that distinguish what ANSI compliance is. Actually, I haven't had any C or C++ books lying around for many years (while I wrote those zillion of lines of code).
However, I am very thoughtful and self-conscious about the architectures of my applications, and the code I write. And I adhere to simple, straightforward (but hightly efficient) practices.
The fact that I designed and implemented programming languages/compilers/IDEs in the past is a double-edge sword, I suppose. It makes me notice, cringe-at, and mostly avoid the most horrific aspects of the design of the C (and C++) languages. OTOH, who knows how close my modus-operandi is to ANSI compliant. And frankly, you'll need to tell me what are the practical consequences of ANSI compliance, because I have no idea! All I know is, the state of system software is utterly horrific (and yes, much worse on windoze that linux). So, if *this* is "compliant", my response would be "who cares?" and "how would that help?".
Last night I read a few dozen emails between [what seemed to be] the implementors of [some of the] C/C++ compilers for linux (including gcc), including discussions of how to choose whether wchar_t would be signed or unsigned. Regardless of the final results (which I still cannot sort out), the considerations taken into account, and the thinking processes involved were mostly horrible! :-(
It appears I have two general choices. (1): keep the code in my applications clean, consistent and mostly free of endless useless syntax - but then I must write my own function libraries that hide the endless craziness and inconsistencies of common/system function libraries. (2): clutter my code with garbage (endless #if/#ifdef/#ifndef blocks, casts, etc) to make my code work with whatever variants I can *guess* may exist in different implementations. Usually I choose door #1.
It is absurd to make character data-types signed, but after reading those old forum conversations, I can understand why just about any result is possible (the issues they considered were almost ALL utterly irrelevant side-issues like "who did what when and where").
I suspect ANSI compliant for C and C++ are quite different. My code contains no classes, but I usually compile with the C++ compiler to take advantage of a few actual improvements and conveniences in C++ syntax. Unfortunately, it is looking like wchar_t might have become a C++ "built-in data-type" that cannot be changed or over-ridden (as I tried to do in my code last night). Amazingly, however, it does appear that some C++ compilers make wchar_t a signed integer, while others make wchar_t an unsigned integer. Sheesh! If this is what "standards" and "compliance" does, I want none of it. :-(
At this point in time, C++ has become a gigantic accumulation of horrible decisions made by different people along the way (implemented differently here-vs-there), and generally on the basis of arbitrary side-issues, and rarely careful thought. The only salvation at all is - the originators of C were far more thoughtful and careful than those who followed.
Thanks for your comments.