tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: style: clean up mentions of old-style C
>>> [...] a main() that expects the env argument.
>> I don't think I've *ever* seen that used.
> Neither have I.
I think I have, but not often and long enough ago I'm not sure of
details.
> I see no problem in disallowing the env arg to main, it's not in any
> (modern?) C standard anyway.
It's sort-of in C99, though I don't know whether you count that as
"modern". 5.1.2.2.1 #1 says that "The function called at program
startup is named main. The implementation declares no prototype for
this function. It shall be defined with a return type of int and with
no parameters [...example...] or with two parameters [...example...] or
equivalent; or in some other implementation-defined manner.". The part
after the last semicolon looks to me as though it allows _any_
declaration for main, from the traditional argc,argv,envp to
int main(struct stat *, pid_t, pid_t, void *, const double * const *),
though clause #2 may require it to have parameters that operate like
argc and argv. I'm not sure about a return type other than int.
Given C's tendency to codify existing practice, I suspect you'll have a
hard time finding a C standard that forbids argc,argv,envp.
/~\ The ASCII Mouse
\ / Ribbon Campaign
X Against HTML mouse%rodents-montreal.org@localhost
/ \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B
Home |
Main Index |
Thread Index |
Old Index