TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: ANTHONY TIBBS
from: RON BASS
date: 1998-01-30 00:31:00
subject: Re: sort.cpp

You wrote:
 AT> ... and I would do
 AT> int main (void)
 AT> After all, void main() will be accepted by the compiler, 
 AT> but is technically illegal/incorrect.
Interesting pair of details that would be completely correct in the C echo, 
and which are both dubious, if not wrong in C++.
Firstly, the draft C++ standard apparently does permit main to return a void. 
 The draft standard defines a main function that has no return value as 
effectively returning 0.
Secondly, the need to explicitly use the keyword "void" to indicate that a 
function takes no arguements is deprecated as not needed in C++.  It was a 
kludge introduced in C to allow old style function declarations to live with 
ANSI C declaration rules.  In C++ the declaration "void main();" can only 
mean that main takes no arguements and returns no value.  This contrasts with 
C, where this declaration would simply not give any information about 
possible arguements for the main function.
    -Ron  (ron-bass@ti.com)
--- EZPoint V2.2
---------------
* Origin: There's a point here, somewhere... (1:128/13.3)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.