Passing functions in C

Brad Appleton brad at SSD.CSD.HARRIS.COM
Tue Mar 13 03:24:44 AEST 1990


OOPS -- I screwed up! the body of function "runAfunct" in my
previous post should have been "return (*myfunct)();" 
not "(*myfunct)();" without the return !!!

My most sincere apologies.

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?

advTHANXance

+=-=-=-=-=-=-=-=-= "... and miles to go before I sleep." -=-=-=-=-=-=-=-=-=-+
|  Brad Appleton                       |  Harris Computer Systems Division  |
|                                      |  2101  West  Cypress  Creek  Road  |
|      brad at ssd.csd.harris.com         |  Fort  Lauderdale, FL  33309  USA  |
|     ... {uunet | novavax}!hcx1!brad  |  MailStop 161      (305) 973-5007  |
+=-=-=-=-=-=-=-=- DISCLAIMER: I said it, not my company! -=-=-=-=-=-=-=-=-=-+



More information about the Comp.lang.c mailing list