W
Wang Yip
We hear "C programmers must manage memory for themselves". Is mean IOf what value is your ``always''?
How different are your uses from each other?
If you use ``viod main'' in five hundred different programs, and it
always works, but they all use the same compiler, run-time library
and operating system, don't you think that these 500 programs
are really just one test case? Don't you think that these 500 programs
demonstrate only a /single/ data point: that void main works with
that compiler and run-time environment?
It's a big jump from a single data point to ``always''.
Consider this: C has a static type system. Functions have a type.
The function int X(int) is not compatible with void Y(int) .
If you were writing a device driver at an embedded company, and one
of the functions is declared as a pointer:
int (*transmit)(netdev *dev, netpacket *);
would you implement it like this:
void my_transmit(netdev *dev, netpacket *);
?
Your compiler would tell you that the address of my_transmit
is not assignment-compatible to the transmit function pointer:
static netdev dev = { ..., my_transmit, ...}; /* error */
Suppose it's only a warning, and it compiles anyway. When the OS calls
the driver's my_transmit, what do you think happens when the function
returns? The caller expects a return value, but the function is void.
Can you point the newsgroup to the chapter of some document
which defines what happens in that situation?
What makes you think you can just pick a random function type out of the
air and use that for your main function?
must know when to write to virtual swap page in disk and how to do it....