Passing functions in C

Charles Hannum CMH117 at psuvm.psu.edu
Wed Mar 14 05:45:30 AEST 1990


In article <3243 at hcx1.SSD.CSD.HARRIS.COM>, brad at SSD.CSD.HARRIS.COM (Brad
Appleton) says:
>
>incidentally, that brings up an interesting point! If I have a function
>
>   int foo() { int i; i = 10; }
>
>without a specified return value, what will be returned when foo is called.
>On one compiler I have used, it will return "10" because 10 was the last
>"thing that was evaluated". I doubt that this is reliable however (is it?)
>
>Should the compiler catch the "missing return" or is that left strictly
>to lint?

Old style C compilers that did not support the void type simply used int
functions that didn't return a value.  Thus, out of habit, some compilers
*still* don't catch missing return values.  There should at least be a
warning you can turn on that will catch this, though you should be able
to turn it off when working with old C programs.

>advTHANXance

Cute.


Virtually,
- Charles Martin Hannum II       "Klein bottle for sale ... inquire within."
    (That's Charles to you!)     "To life immortal!"
  cmh117 at psuvm.{bitnet,psu.edu}  "No noozzzz izzz netzzzsnoozzzzz..."
  c9h at psuecl.{bitnet,psu.edu}    "Mem'ry, all alone in the moonlight ..."



More information about the Comp.lang.c mailing list