if (e1) return e2; [else] s1;

John Hascall hascall at cs.iastate.edu
Mon Mar 26 04:57:45 AEST 1990


In article <10624 at alice.UUCP> ark at alice.UUCP (Andrew Koenig) writes:
}Some people take the view that except at the end of a function,
}`return' is just a funny way of spelling `goto.'

  There's no accounting for taste, I guess...                :-)

  Anyhow, I took a stroll through K&R1 and lo and behold (oh dear,
  say it isn't so!) I found `return's not at the end of a function:

    FUNCTION  PAGE 
    binary      54
    index       67
    push        75
    pop         75
    getop       78
    alloc       97
    strcmp     101
    strcmp     102
    readlines  107
    numcmp     117
    binary     125
    getword    127
    type       127
    binary     129
    lookup     135
    install    136
    (got tired of looking...you get the point)

-----------------------------------------------------------------------
Also, I found a couple of interesting remarks on: return ( expr )

[page 68]   ... Any expression can follow return:

                   return(expression)

[page 70]   ... The value of the expression in

		   return(expression)

	    is always converted ...
-----------------------------------------------------------------------

John Hascall
hascall at atanasoff.cs.iastate.edu



More information about the Comp.lang.c mailing list