Programming Style

Doug Gwyn gwyn at smoke.brl.mil
Fri Apr 19 02:30:59 AEST 1991


In article <3264 at borg.cs.unc.edu> morse at hatteras.cs.unc.edu (Bryan Morse) writes:
>The general opinion has often surfaced here that, "Well, it may be in the
>standard, but if you do it it won't be portable."  Huh???  I realize that
>it takes time for a standard to emerge and that compliance is optional,
>but does that mean we should continue to write every C program according
>to K&R Edition 1, First printing?  Never use enums, never use prototypes,
>never use voids, never return structures...

Certainly I am a proponent of C standard conformance, and some day
we may be able to rely on that for application source portability.
However, it is a fact of life that currently many C implementations
are far from standard conforming.  I've found that the implementations
I personally have to deal with fall into two categories (with small
glitches due to compiler bugs etc.):  standard conforming, or else
based on UNIX PCC.  Thus a fairly minor amount of kludgery in the
application source code can attain much wider portability of the
application than limiting it to either environment alone.  As part
of this accommodation of non-standard implementations, one often
needs to avoid assuming full ANSI C behavior of the implementation;
often this practice does not do major violence to the source code.



More information about the Comp.lang.c mailing list