two mains

David Nadlinger see at klickverbot.at
Sun Jan 27 05:57:14 PST 2013


On Saturday, 26 January 2013 at 20:42:27 UTC, Tyro[17] wrote:
> Trying to learn from the ground up and would appreciate some 
> assistance making sense of the following:
>
> // void main(){} [1]
> [...]

This might not be directly relevant here, but in general, I'd 
steer clear of main() for such experiments. Due to its special 
nature (several possible signatures, but the calling code in 
druntime stays the same), there is quite a bit of extra magic 
going on internally.

For example, you wouldn't normally find "xor EAX, EAX" in a 
void-returning functions, as its purpose is to set the return 
value to 0, which implicitly happens to make the void main() and 
void main(string[]) variants conform to the "full" int 
main(string[]) signature.

David


More information about the Digitalmars-d-learn mailing list