Hnefi
February 24th, 2006, 05:27 AM
Hi. I was helping a friend yesterday who needed to set up a compiler on her home computer in order to do some labwork for a course in OS programming.
I looked through part of the code for the lab skeleton because it refused to compile, and I found many strange things. One thing, however, made me hesitate as to whether this lab skeleton even conforms to the standard at all, namely the following:
main(argc, argv)
int argc;
char *argv[];
{
<stuff>
}
Note the lack of return type for main, the lack of type for the parameters and the odd decision to specify the headers between the parameter list and the function definition. Is this even allowed in C or does it cause undefined behaviour?
I looked through part of the code for the lab skeleton because it refused to compile, and I found many strange things. One thing, however, made me hesitate as to whether this lab skeleton even conforms to the standard at all, namely the following:
main(argc, argv)
int argc;
char *argv[];
{
<stuff>
}
Note the lack of return type for main, the lack of type for the parameters and the odd decision to specify the headers between the parameter list and the function definition. Is this even allowed in C or does it cause undefined behaviour?