YALF (yet another lint foulup)

Ken Raeburn raeburn at athena.mit.edu
Sun Jan 1 07:18:23 AEST 1989


In article <14672 at cisunx.UUCP> cmf at unix.cis.pittsburgh.edu (Carl M. Fongheiser) writes:
>In article <9228 at smoke.BRL.MIL> gwyn at brl.arpa (Doug Gwyn (VLD/VMB) <gwyn>) writes:
>>What do you mean?  Function value type and whether a function returns
>>are orthogonal.
>Really?  I'm having a good deal of difficulty thinking of any reason why
>one would declare a function which never returns as anything other than
>void.

How about type consistency?  Consider a library package which lets you
supply procedures to run, and expects a structure returned; some
compilers would allocate an invisible first argument telling you where
to put the structure.  If you want your procedure to read its
arguments properly -- even if it's going to do nothing more than print
them out and exit or abort -- its return value must be declared
properly.  (Okay, so I can't name such a package offhand.  The example
is still valid....)

Declaring it as returning some (non-void) type when it is known not to
return is pointless when you've got your choice, but if you have to
mesh with some existing scheme you have to do it anyways.

~~ Ken



More information about the Comp.lang.c mailing list