C/C++ Programmer's Guide (G06.27+, H06.08+, J06.03+)
and the NOWARN pragma disables the compiler from generating all or a selected set of warning
messages. The compiler defaults to WARN, which enables all warning messages.
G.3.2 Environment
No library facilities are available to a freestanding program.
In a freestanding environment, program termination is:
• The program termination phase of execution begins when a program returns from the function
main, calls the exit() library function, or calls the terminate_program() library function.
In each case, the C library flushes all file buffers, closes all open files, and causes the process
to complete with a certain completion code, depending on what caused the termination.
• When the process returns from main with no return value, the process stops with a completion
code of 0, normal termination.
• When a program calls exit() or terminate_program(), the process completes with
normal or abnormal termination depending upon the completion code assigned to the status
or options parameters, respectively.
HP TNS C allows the declaration of up to three parameters to the program's function main.
int main(int argc, char *argv[], char *env[])
DescriptionParameters
An integer value specifying the number of elements in the argument array argvargc
The argument array. Each element (except for the last) points to a null-terminated string.
argv[0] points to the fully qualified name of the executing program, the executing program
argv
name being that used in the RUN command. Each of the elements argv[1] through
argv[argc-1] points to one command-line argument; argv[argc] has the pointer value
NULL.
The environment array. Each element (except for the last) points to a null-terminated string
containing the name and value of one environment parameter. The last element has the pointer
value NULL.
env
When declaring parameters to the function main, note:
• The parameters to main are optional; there can be no parameters, argc and argv, or all
three parameters. env alone is not allowed.
• The identifiers argc, argv, and env are simply the traditional names of the three parameters
to main; any identifiers may be used.
• The elements of the environment array env point to strings of the form:
param-name=param-value
where param-name is the name of the environment parameter, and param-value is its
value.
These are valid interactive devices:
• Asynchronous terminal
• Paired display and keyboard
• NonStop OS processes
G.3.3 Identifiers
No characters beyond 31 are significant in an identifier without external linkage. Beyond 6
characters, only 2 are significant in an identifier with external linkage. Case is significant in an
identifier with external linkage.
Implementation-Defined Behavior of TNS C 407