Subject: Re: defvar and (declaim (special ...))
From: Erik Naggum <erik@naggum.no>
Date: 1999/04/10
Newsgroups: comp.lang.lisp
Message-ID: <3132775216232302@naggum.no>

* Kent M Pitman <pitman@world.std.com>
| I think C .h files and the idea of multiple declarations are an
| abomination.

  C should get all the deserved heat it can get, but in this case, it's
  less ugly than it appears to be.  there can be only one declaration of
  any object, and only one definition in the appropriate scope.  multiple
  instances of each is an error.  however, you don't have to declare
  something, because the definition will itself declare it if it was
  undeclared, and the definition doesn't have to be found in the same
  compilation unit, only the declaration if there are references.  the old
  K&R C definition was pretty relaxed about these things, but ANSI and ISO
  cleaned up this mess.

  all of this in C is to support separate compilation of files with a
  completely ignorant compiler that produces object files that contain
  nothing but the bare essentials to build "executables".  no other
  language is able to survive at this level of pandemic ignorance, and
  various harsh measures are required to cope with the compiler/linker
  relationship in C and consequently under Unix, such as many output files
  from the compiler and the danger of loss of synchronization between these
  files, so there's no doubt they have serious problems, but it isn't
  because of multiple declarations as far as the compiler sees it.

  well-written C also keeps declarations in header files and definitions in
  source files, so there should actually be only one decleration of each
  object, anyway.

#:Erik