943,879 Members | Top Members by Rank

Ad:
  • Assembly Discussion Thread
  • Unsolved
  • Views: 1601
  • Assembly RSS
You are currently viewing page 2 of this multi-page discussion thread; Jump to the first page
Nov 30th, 2008
0

Re: wat does this do

The main method is often misunderstood.

In C89, main() on its own is acceptable, but C99 only allows for either (The second one is for command line paramaters):

Quote ...
int main ( void )
int main ( int argc, char *argv[] )
In C89, main() MUST return something but C99 says if a return statement is absent, then 0 is implied (sucess). I do however think this has been removed in newer standards. This is as when C was new, void did not exist and the machines of the time required that the program return an integer value for sucess or not. Anything other that 0 (sucess) was logged.

In C++ there is allowed

Quote ...
int main ( int argc, char *argv[] )
int main ()
Note that int main() is NOT void. The empty brackets do NOT indicate no paramaters, they in fact indicate an unlimited number of paramaters.

The ISO C Standard (ISO/IEC 9899:1999) says it is also illegal for C++ to have a return type of void. The return type should be an integer and the function should return 0 or EXIT_SUCCESS; at the end. A return type of void does NOT mean it returns nothing, it just means it returns a junk value which will pribably not be 0.

I do hope thats right, that just my understanding from my notes.
Moderator
Featured Poster
Reputation Points: 1767
Solved Threads: 574
Moderator
jbennet is offline Offline
16,519 posts
since Apr 2005
Dec 8th, 2008
0

Re: wat does this do

ahh, I see
Reputation Points: 5
Solved Threads: 1
Unverified User
carson myers is offline Offline
33 posts
since Sep 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Assembly Forum Timeline: code snipp
Next Thread in Assembly Forum Timeline: using STDCALL





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC