P
prasoonthegreat
Is void main legal in C....I know according to the standards it is
illegal in C++....
But after reading the standards.....
The C Standard currently says that an implementation is free to define
any additional forms for main that it cares to. § 5.1.2.2.1.1 of the C
Standard lists the allowable forms for the definition of main. Because
of the semi-colon, its final sentence parses as follows:
It shall be defined
* with a return type of int and
o with no parameters [...] or
o with two parameters [...] or equivalent;
or
* in some other implementation-defined manner.
(Furthermore, § 5.1.2.2.3.1 says, of main,
If the return type is not compatible with int, the termination
status returned to the host environment is unspecified.
which indicates that allowing forms that do not return int is
intentional.) .......
So can it(void main) be considered legal in C or not.....It is known
to me that using void main is dangerous as it leads to process stack
corruption sometimes .....
So please focus on its legality!!!!!
Prasoon
illegal in C++....
But after reading the standards.....
The C Standard currently says that an implementation is free to define
any additional forms for main that it cares to. § 5.1.2.2.1.1 of the C
Standard lists the allowable forms for the definition of main. Because
of the semi-colon, its final sentence parses as follows:
It shall be defined
* with a return type of int and
o with no parameters [...] or
o with two parameters [...] or equivalent;
or
* in some other implementation-defined manner.
(Furthermore, § 5.1.2.2.3.1 says, of main,
If the return type is not compatible with int, the termination
status returned to the host environment is unspecified.
which indicates that allowing forms that do not return int is
intentional.) .......
So can it(void main) be considered legal in C or not.....It is known
to me that using void main is dangerous as it leads to process stack
corruption sometimes .....
So please focus on its legality!!!!!
Prasoon