Programming Style

Bryant Eastham u-beasth%peruvian.utah.edu at cs.utah.edu
Wed Apr 17 07:46:55 AEST 1991


  In an attempt to understand the attitudes of some people on the net I
submit the following:

  NEWS FLASH
  ----------
  The QWOP Corporation announced yesterday that it will NOT support certain
  constructs of the ANSI C Standard in any of its new compilers.  In the
  words of J.W. Antistandard, QWOP's President, "the constructs are unneeded,
  and can easily be kludged with other constructs that we do support."  He
  continued by urging, in the name of portability, that computer programmers
  throughout the civilized world discontinue the use of these unsupported
  constructs, or at very least bracket them with #if and #endif so that they
  can easily be enabled or disabled at compile-time.



  To prevent needless flames, the above is a joke - but seems to mirror
the attitudes of some people that have recently posted to the net in regards
to nested includes.

  I believe that "ANSI C" is a standard. A compiler is just a program! When
                                         -----------------------------
the standard says that system headers may be included multiple times then
write code as though they can.  If you then find a program (read: compiler)
that can't handle the nested includes, then I suggest:

   1) Fix the program (read: compiler).  Use your ingenuity.  If the
      system-supplied headers cannot be included multiple times then
      shadow them with other headers (that you will write) that include
      adaquate protection and include the system-supplied headers.  That
      is why compilers give us smart programmers control over directory
      search paths.

   2) Write to or otherwise contact the author(s) of the "broken"
      program (read: compiler).  Complain to them.  Get them to conform
      to the standard just as you are trying to conform to it.  With few
      exceptions the author(s) or the program (compiler) are in it to
      make money and your input will have a good chance or influencing
      them.  If they are unwilling to change then you may really consider
      junking their program (read: compiler) and using one that will keep
      up with current trends (and standards).

  Another argument against using nested includes is the added time needed
to compile.  Using this logic they should also be using 1 character
identifiers to speed up symbol table lookup during compilation, and I
don't want to see a single floating point operation in their code unless
the target machine has a coprocessor to speed up these time consuming
operations.

  The point is, data abstraction, which is made possible by nesting includes,
is an accepted and desirable technique and a real programmer will be more
concerned about using valid techniques than having to wait a few minutes
more to compile his code.  Future generations will call him blessed!

  LET THE FLAMES BEGIN!
  Does anyone have an asbestos suit I could borrow?

  Bryant Eastham
  A Programmer who would die without nested includes.
  Long Live makedepend and gcc.




More information about the Comp.lang.c mailing list