This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: First basic program


Its interesting... 
Its eliminate any doubt. :)

for curiosity... where I found the ISO C++ Standard and ISO C Standard?

thanks for the link!

Em Seg, 2003-02-24 às 01:31, Dockeen escreveu:
> Here is a quote from a page from Bjarne that might 
> be of some interest on the main returning an int front...
> 
> 
> "Can I write "void main()"?
> The definition 
> 	void main() { /* ... */ }
> 
> is not and never has been C++, nor has it even been C. See the 
> ISO C++ standard 3.6.1[2] or the ISO C standard 5.1.2.2.1. 
> A conforming implementation accepts 
> 	int main() { /* ... */ }
> 
> and 
> 	int main(int argc, char* argv[]) { /* ... */ }
> 
> A conforming implementation may provide more versions of main(), 
> but they must all have return type int. The int returned by main() 
> is a way for a program to return a value to "the system" that 
> invokes it. On systems that doesn't provide such a facility the 
> return value is ignored, but that doesn't make "void main()" 
> legal C++ or legal C. Even if your compiler accepts "void main()" 
> avoid it, or risk being considered ignorant by C and C++ programmers.
> 
> The quote comes from here:
> 
> http://www.research.att.com/~bs/bs_faq2.html#void-main 
> 
> Wayne 
> 




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]