effect of free()

Scott Amspoker scott at bbxsda.UUCP
Tue Sep 19 02:03:56 AEST 1989


In article <10829 at riks.csl.sony.co.jp> diamond at ws.sony.junet (Norman Diamond) writes:
>
>>6)  Therefore, we all agree to avoid those compilers thus driving the
>>    vendors out of business and we have nothing to worry about.
>
>If you wish to personally boycott all compilers that do optimization,
>feel free.
>

Thank you, we do feel free.  We have over 60000 lines of 'C' code that
runs unmodified and over 40 different systems (different OS and
hardware archetecture).  The nature of our application is such that
we do a *lot* of pointers-to-structures (so yes, we benifit from
pointer optimization).  In order to earn a living and feed our families
we have had to make sure our C code is as safe and conforming as possible 
(no tricky stuff).  I would hazard a guess that many other software 
developers would get bit long before we do (based on some of the postings
I've seen in this group).

However, once in a blue moon a C compiler comes along that appears to 
go out of it's way to make trouble.  We have turned down brain-damaged 
compilers before and it hasn't hurt us one bit.  Although I have never seen a
compiler/architecture combination that has unsafe pointer compares
I have seen some other bizzare things.  Fortunatly, these things happen
very rarely and *never* with a well known company (although well-known
companies do have bugs).

For example, since we run on Intel cpu's we use the "near" and "far"
keywords.  When we compile on other environments we must remove
those keywords.  We do so with:

#define near
#define far

So far, so good.  Now along comes a C compiler that doesn't support
"near" and "far" but also WON'T LET US REDEFINE NEAR AND FAR either.
(because near and far are reserved).  For crying out loud!  In this case
it was easy for us to do the port anyway because it required a simple text 
string substitution across all of our source.

Perhaps we will run into something that is the result of some obscure
assumption we made that, technically, is non-comforming.  While we
would admit that we were wrong we would also remind ourselves that we
have been doing extremely well so far and wouldn't necessarily take
the expense to re-write all our code.  That's life.  I realize that
this group is much more academic.  If you want to sell a C compiler
in today's market you better make sure it can run a lot of existing code
without any trouble.  Where one draws that line is a matter of personal
taste.  I personally don't think that every little bit of optimization
has infinite value when there are so many other things to consider.



More information about the Comp.lang.c mailing list