Mail Archives: djgpp/1993/11/10/10:39:23
> my first question is this. i have a copy of go32 1.08
> if i accidentally type "go32 file.c" or any non-gcc executable
> file it locks my computer up. i understnad why this happens i am
> just wondering if in any of the newer version it terminates instead
> of crashing.
I think this has been fixed, but it's worth trying again to be sure.
> second guestion. when writing c++ code, i have to make main an int not
> a void and return needs a value, what is the reason behind this??
> from what i remember about my c++ class i had god knows how long ago
> we could do this:
> void main()
> {
> program lines
> return;
> }
> but when i tried this with djgpp it forced me to do it this way:
> int main()
> {
> program lines
> return 0;
> }
> just curious as to why this is. thanks.
ANSI specifies that main be declared as "int main(...)". Gcc enforces
this, as it must know about main in order to do certain kinds of C++
overhead (specifically, calling __main()). Thus, you are required to
follow the prototype. Since the return value of main is the return
value of the program itself, not returning a value is asking for
trouble.
- Raw text -