Unnecessary parenthesis
Daniel R. Levy
levy at ttrdc.UUCP
Mon Jul 11 09:06:51 AEST 1988
In article <17458 at tut.cis.ohio-state.edu>, mdf at tut.cis.ohio-state.edu (Mark D. Freeman) writes:
> In <2550075 at hpisod2.HP.COM> decot at hpisod2.HP.COM (Dave Decot) writes:
> >Return is a statement that modifies the default
> >flow of control, such as:
> > goto label; /* NOT goto(label); */
> > break; /* NOT break(); */
> > continue; /* NOT continue(); */
> >Return is not a function call, and it shouldn't look like one.
> >Why do you want to make it easier to confuse function calls
> >with statements that don't come back?
> What about exit()? Does it require parenthesis? How does it fit into
> your argument?
Butting in, I say:
exit() is a bona fide, real, genuine, honest-to-goodness FUNCTION CALL.
It just so happens that the usual effect of calling it (besides miscellaneous
cleanup actions, such as flushing any open stdio buffers) is to stop
execution of the program that called it. Were you to feel a bit wild and
crazy some time, you could perfectly well write your own exit() which could
do whatever oddball things it wished and not stop the program at all when
called. E.g.,
exit(i) int i; { printf("nyah nyah you tried to exit %d\n", i); }
"return" is DEFINED as stopping execution of the FUNCTION that called it
and returning control (and a value, if specified) to "whatever" called that
function, whether it was another function, or some veiled-from-view system
mechanism (as with main() or as an interrupt handler).
--
|------------Dan Levy------------| THE OPINIONS EXPRESSED HEREIN ARE MINE ONLY
| AT&T Data Systems Group | AND ARE NOT TO BE IMPUTED TO AT&T.
| Skokie, Illinois |
|-----Path: att!ttbcad!levy-----|
More information about the Comp.lang.c
mailing list