Obscure C code (was Re: Excessive optimization)

Ethan Dicks ethan.dicks at gmail.com
Thu Dec 2 18:03:30 CST 2010


On Thu, Dec 2, 2010 at 6:54 PM, Eric Smith <eric at brouhaha.com> wrote:
> Ethan Dicks wrote:
>> Looking at what's there, I'd say that it wouldn't surprise me that
>> some compilers would accept it (gcc does) and some might not,
>
> It's legal, standard-conformant C code, so any compiler that doesn't deal
> with it is broken.

I got my start with Whitesmith's C for VMS (pre-ANSI).  I can't recall
details 25 years on, but ISTR we had an occasional issue where code
that compiled fine on a 4BSD box could choke Whitesmith's (and that
the pain points were pointer-math-related).

It's made me shy to claim that "of course it will work anywhere" when
it comes to C.  Compiler writers, like all other programmers, can
suffer from a lack of vision about what's allowed vs what's required
vs what happens to have been used as a test case during development.
That's one reason for ongoing compiler development - nobody's perfect,
especially not at Rev 0.1.

-ethan



More information about the cctech mailing list