Well, as long as your not one of them voiders!!! :DQuote:
(I still use int main, so don't accuse me to be a voider )
Printable View
Well, as long as your not one of them voiders!!! :DQuote:
(I still use int main, so don't accuse me to be a voider )
I, also, use int main(), but void main() doesnt seem too bad to me
microsoft may define the return value of a void main function as zero, but that's not a standard consensus. other compilers simply ignore the return value, which may cause your operating system to suspect a problem.Quote:
Originally posted by Magos
Then what's so evil about it? Ok, you cannot specify an error return code if your program fails to do some stuff, but that seems kinda minor to me...
(I still use int main, so don't accuse me to be a voider :D)
Quote:
void main() doesnt seem too bad to me
NOOOOO!!!! Stay away from the light!!!!
*Looks in fear over shoulder for Prelude *
I always ask myself, if they say that int main() is the standart way, why don't we just stick to it?
And why are all these threads about int/void main().
Using void main() won't make our lifr easier.
Note: I think in the FAQ's there is a section about that.
By The Way, check out Salem's avatar, they are doomed:)
void main()
void main()
void main()
void main()
Wheee void main() rocks!!
Oh my goodness. Prelude is gonna go ballistic. We have all seen her let off steam before about void main(). Now we have a thread created solely for the purpose of debating the issue. Dig yourselves a trench fellas and take cover, this could be messy!!
Yeah...Tell me about itQuote:
Oh my goodness. Prelude is gonna go ballistic
You can either choose to do the right thing, and try to learn as much about the language as possible so that your programs have the most chance of working because you've learnt ANSI-C. This approach will stand you in good stead for when you have to use a new compiler (or even the next version of the one you're using now).
Or you can choose to riddle your programs with all sorts of undefined behaviour because you've learn dialect-C, and so long as it "works for me" that's OK right. This approach will really bite you in the ass in the long run and you find that you have to unlearn all your bad habits ([yoda]you must unlearn what you have learnt if you are to learn the ways of the source[/yoda]) when you have to move to a new environment. If you are fortunate, you will decide to make a much better job of learning the language the 2nd time around.
If you are wise, you'll make sure you try and make a decent job of it the first time round.
So if you want to keep all your small programs private, compile them once and throw them away after they've served their immediate purpose then go ahead use all the undefined behaviour you want - its only your time you're wasting, and the rest of the world can go about its business.
But if you want to write a large program, or work with other peoples code (and have others work with yours), and you want to avoid your fellow programmers wrath / humor / distrust, then you'll want to seek out and remove as much undefined behaviour from your programs as you can, and learn the language properly so that you don't add undefined behaviour as a matter of habit in the first place.
Remember, void main could say a lot more about the rest of your code than you would care to admit.
http://www.cprogramming.com/cboard/s...threadid=29141
http://www.cprogramming.com/cboard/s...threadid=28633
http://www.cprogramming.com/cboard/s...threadid=28311
http://www.eskimo.com/~scs/C-faq/q11.15.html
http://www.eskimo.com/~scs/C-faq/q11.12.html
And just for those void main'ers who cling to - nobody looks at the exit status
http://www.eskimo.com/~scs/C-faq/q11.14.html
([yoda]you must unlearn what you have learnt if you are to learn the ways of the source[/yoda])
Thats funny.
:)
I think we've had enough void/int main conversations for now. If you haven't worked out what is correct by reading this thread, do a seach to find out more.
Now please.... no more! :)
<closed: any questions, pm me.>