[prog] [C] strings bug

Robert J. Hansen rjh at sixdemonbag.org
Fri Apr 11 22:15:33 EST 2003

> Robert probably knows, but some folks may not, that compiling a program
> on one machine is not a valid test of whether a feature is part of a
> language standard, nor is it a good test of whether a feature is
> portable.  All it tells you is how a feature works in one version
> of one compiler.

On the other hand, if you know that a given compiler conforms strictly
to spec, it can be a useful test to see whether or not a given code
construction is valid.  It's not 100% reliable, no, but if you're
confident in your compiler, it can give you a pretty good measure of

GCC, unless I'm seriously misremembering, conforms strictly to ANSI/ISO
C89 when it's passed the -ansi -pedantic flags.

Agreed that spec conformance is insufficient in and of itself: there are
always going to be braindamaged platforms which don't support the spec. 
I've run into this problem an awful lot more with C++ compilers than C
compilers, however: having good, ANSI-conformant C89 compilers is, in my
experience, pretty much a given across platforms.

C++ compilers, I've found, you take your chances.  :)  Particularly with
the standard library/STL.

More information about the Programming mailing list