Function declarations (was: MSC v5.1 Bug???)

der Mouse mouse at mcgill-vision.UUCP
Thu Sep 1 19:06:32 AEST 1988


In article <371 at pigs.UUCP>, haugj at pigs.UUCP (Joe Bob Willie) writes:
> In article <1757 at microsoft.UUCP> microsof!markro writes:
>> In article <356 at sdrc.UUCP> scjones at sdrc.UUCP (Larry Jones) writes:
>>> NO!!!  Amazingly enough, MSC got this right - the code is wrong.
>> [F]rom the May 88 draft standard (3.5.1, pg 56, lines 19-20):
>>  "The declaration of an identifier for a function that has block
>>   scope shall have no explicit storage-class specifier other than
>>   extern."
> i have used function declarations inside of functions to document
> where a function is used.  now they are telling us we can't document
> static functions in this fashion.

Not at all; just that you can't mention that they're static in the
block.  I *would* be surprised to find that there's anything wrong with
something like

foo()
{
 ...
  { double glurf(char*,int);
    ...
  }
 ...
}

static double glurf(char *s,int maxlen)
{
 ...
}

You're confusing the two meanings of the static keyword.  When used
inside a function, `static' means one thing: the object being declared
has static storage class.  Here, `static' really is a storage class
specifier.  Outside a function, `static' means something else: the name
being declared is to be accessible only from within the file the
definition appears in.  Here, it's really a linkage specifier rather
than a storage class specifier.

In retrospect, I think it was probably a mistake to overload `static'
this way, but it is certainly far too late to change it now.

					der Mouse

			old: mcgill-vision!mouse
			new: mouse at larry.mcrcim.mcgill.edu



More information about the Comp.lang.c mailing list