Re: 3 Questions

From: Daniel A. Koepke (dkoepke@circlemud.org)
Date: 01/31/01


On Mon, 29 Jan 2001, Peter Ajamian wrote:

> Do you really want to drag the EXIT_FAILURE debate back on the board?  I
> had dropped the issue but...

No.  It was a remark about the irony that in one discussion you were
advocating conformance and I tossed it by the way-side; in this case, you
are tossing a standard by the way-side.  (Note that I'm hesistant to say
I'm advocating conformance to C99 -- that's not what I'm doing and I've
been pretty clear that it's a trade-off from the start, I think.)  Settle
down.

> Any compiler that has any kind of decent optimization will eliminate
> any efficiency benefit that decalring a variable mid-function has.

That's a generally false assumption.  Any time an expression can have a
side-effect, the compiler cannot reasonably reorder it because it could
break the code following it.

> We are dealing with now, not eventually.

And code is finished and released eventually, not now.  And is supported
over time, not at the one instant 'now'.  And used by people eventually,
not at the one instant 'now'.  And so forth.

> I know of people who have gone through the trouble of compiling and
> running CircleMUD on ancient Unix platforms that only have an old
> version of cc.

If that's their kick, then they're free to have it.  The code should not
bend to support traditional C, even though it might be "more portable."
Everything is a balance between convenience, readability, efficiency,
elegance, functionality, developer preferences, and portability.  The
persistent advocacy of portability over the rest is fool-hardy.

> However (correct me if I'm wrong) it is my understanding that any
> program that adheres fully to the older ANSI standard will also adhere
> fully to the newer C99 standard, though the opposite ceartainly is not
> true.

The opposite _can_ be true.  Standards have little to do with portability
because most platforms don't strictly conform to every standard.  And it's
trivial to use features of C99 and disable them/emulate them using the
preprocessor.  The trade-off is readability.

> When it comes to advising newbie coders I would always advise them in
> the direction of keeping thier code portable.

If they're following a standard that is coming into increasing use and
want to take advantage of it, then they ought to.  And if at some time in
the future they need to port to a platform without a C99-conforming
compiler, they can deal with it then and make up their own mind about the
gains and costs of the bleeding edge.

I gave a complete answer to his question along with the provisional
warnings about it being bleeding edge.  Now you're free to lie to newbies
about the infeasibility and call C99-conformance stupid if you want to,
but I'll continue to try to give options rather than solutions regardless
of whether you think new standards, old standards, no standards, some
standards, half standards, or what-have-you have any merit.

> While I can see lots of reasons to avoid breaking a standard, why on
> earth would anyone want to avoid adhering to one?

For many reasons, one of which you are presently arguing since, after all,
C99 is a standard and you are advocating that people avoid adhering to it.

Portability and standards are not one and the same.


-dak

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/03/01 PST