Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!lll-winken!uunet!auspex!guy From: guy@auspex.auspex.com (Guy Harris) Newsgroups: comp.lang.c Subject: Re: C++ and ANSI C Message-ID: <1567@auspex.auspex.com> Date: 5 May 89 19:25:57 GMT References: <12005@paris.ics.uci.edu> <44100029@hcx2> <1989May4.001911.3382@utzoo.uucp> <3934@tekcrl.LABS.TEK.COM> Reply-To: guy@auspex.auspex.com (Guy Harris) Organization: Auspex Systems, Santa Clara Lines: 33 >> 1. "extern foo();" means (so to speak) "extern foo(...);" in ANSI C and >> "extern foo(void);" in C++ > > Number 1 is incorrect since C++ uses '...' to indicate that the number >and type of arguments is unknown. The void keyword in ANSI C indicates >that the function takes no arguments. No arguments in the prototype in >C++ means that there are no arguments. Uhh, that's what he *said*. ANSI C *also* uses "..." to indicate that the number and type of arguments (following a certain argument) is unknown. The "following a certain argument" is relevant - the December 7, 1988 draft indicates that the ellipsis must follow a comma, which follows an argument; this may be what the "so to speak" indicates. "The empty list in a function declarator that is not part of a function definition specifies that no information about the number or types of the parameters is supplied," so "extern foo();" is equivalent to what "extern foo (...);" would mean if it were allowed. "No arguments in the prototype in C++ means that there are no arguments" is equivalent to "'extern foo();; means ... 'extern foo (void);' in C++"; according to my copy of S ("S" being a construct whose meaning is determined by analogy to "K&R" :-)), under "15.3 Anachronisms", "The keyword 'void' may be used to indicate that a function takes no arguments, thus '(void)' is equivalent to '()'" (so to speak; presumably, () fprintf(stderr, "Doom, defeat, and despair!\n"); is not equivalent to (void) fprintf(stderr, "Doom, defeat, and despair!\n"); :-)).