To ANSI or not to ANSI (was: Re: Just a minor new twist on free())

Paul D. Smith pds at lemming.webo.dg.com
Tue Oct 9 00:13:36 AEST 1990


(comp.std.c readers please ignore this first section ...)

Thanks to everyone who pointed out my brain damage re my "efficiency"
example; obviously I was not completely sane when I posted last.  :-)

The example I mentioned quite obviously depends on the sparseness of
the array: if the array is sparse, then doing the check before the
function call saves you much overhead; if the array is full, then
(maybe) you win by not doing the check (if your library is ANSI
compliant and does the check for you).

I apologize to everyone for taking up their time with this nonsense,
anyway; obviously this is a "personal style" question, whether you
think free() should handle all cases graciously (including NULL), or
think free() should to continue to crap out on NULL, presumably to
locate logic errors.

-----

I do, however, have a new point I'd like to take up some bandwidth
on: basically, I got a lot of responses stating that free(NULL) should
not be used because, although it *is* ANSI compliant, it is not
backward portable.

My question is: since we now have a standard (whatever you may think
of it, it is an internationally accepted definition of the C
programming language), why do we have so much reluctance to embrace
it?  In particular, how can you justify labelling a program
"non-portable" if it follows the ANSI standard?

I understand that many people do not as yet have an ANSI-compliant
compiler, but is really a valid reason for those of us who do to
continue to eschew important enhancements to the language in order to
continue to interoperate with the "lowest common denominator" C
implementations?

Some people mentioned that ANSI compilers are not in widespread use
"yet" (but hey, grab & port GCC and there you go!), and we should wait
until they are -- I ask, when will this be and how will we know it's
time?

Replies via e-mail welcome; I'll post a summary of "net" opinions...
--

                                                                paul
-----
 ------------------------------------------------------------------
| Paul D. Smith                          | pds at lemming.webo.dg.com |
| Data General Corp.                     |                         |
| Network Services Development           |   "Pretty Damn S..."    |
| Open Network Applications Department   |                         |
 ------------------------------------------------------------------



More information about the Comp.lang.c mailing list