ISO/IEC OX99 I990 (E J
int main(int
argc, char *argv[]) { /*. . . */ 1
If they are defined. the parameters to the main function shall obey the following constraints
-
The value of argc shall be nonnegative.
-
argv
[argc]
shall be a null pointer.
- If the value of argc is greater than zero,
the array members argv[O] through
argv [argc-l] inclusive shall contain pointers to strings.
which are given implementation-
defined values by the host environment prior to program startup
The intent is to supply to
the program information determined prior to program startup from elsewhere in the hosred
environment If the host environment is not capable of supplying strings with letters in both
uppercase and lowercase. the implementation shall ensure that the strings are received in
lowercase
- If the value of argc is greater than zero. the string pointed to by argv [0] represents the
/~r~,~r-cmr IKMIC.
argv
[0] [0] shall be the null character if the program name is not available
trom the host environment. If the value of
argc
is greater than one, the strings pointed to
by argv [ l] through
argv
[ argc-l] represent the program parmnerer s
-
The parameters argc and
arg-v
and the strings pointed to by the argv array shall be
modifiable by the program. and retain their last-stored values between program startup and
program termination
5.1.2.2.2 Program execution
In a hosted environment. a program may use ail the functions, macros, type definitions. and
objects described in the library clause (clause 7).
5.1.2.2.3 Program termination
A return from the initial call to the main function is equivalent to calling the exit function
with the value returned by the main function as its argument. If the main function executes a
return that specifies no value. the termination status returned to the host environment is
undetined
Forward references:
definition of terms (7 I I). the exit function (7.10.4.3)
5.1.2.3 Program execution
The semantic descriptions in thi\ International Standard describe the behavior of an abstract
machine in which issues of optimization are irrelevant
Accessing a volatile object. modilying an object, modifying a file, or calling a function that
doe\ any of those operations arc all tit/c eJc( [\. which are changes in the state of the execution
envtronmcnt Evaluation of an expression may produce side effects At certain specified points
in the execution sequence called \I’L/I~‘HI c /~oirtr\.
all side effects of previous evaluations shall be
complrtc and no side ettects ot suh\cqucnt evaluations shall have taken place
In the abstract machtnc. all expresston\ are evaluated as specified by the semantics An actual
implrmentatton need not evaluate part ol an expression if it can deduce that its value is not used
and that no needed side ellect\ arc produced (including any caused by calling a function or
accessing a volatile object)
When the processing oi the ab\tr;Ict machine is interrupted by receipt of a signal. only the
value\ 01 objects as ot the prcvmu\ sequence point may be relied on
Objects that may be
modified between the previou\ scqucnce point and the next sequence point need not have
received their correct values yet
An Instance of each object with automatic storage duration is associated with each entry into m
its block Such an object exists and retains its last-stored value during the execution of the block
and while the block is suspended (hy a call of a function or receipt of a signal)
Environment