C/C++ Programmer's Guide (G06.25+)
Running and Debugging C and C++ Programs
HP C/C++ Programmer’s Guide for NonStop Systems—429301-008
19-4
Invocation of Constructors for Global and Static
Variables
•
stderr denotes the physical file specified in an ASSIGN STDERR command. If you 
do not use the ASSIGN command, stderr denotes the command interpreter’s 
default output file, which is usually your home terminal.
The IN and OUT options of the RUN command were described in Running Programs in 
the Guardian Environment on page 19-1. 
The ASSIGN command you use to specify the standard error file has the form:
ASSIGN STDERR, file-name
where file-name is a valid file name representing a physical file that the C compiler 
can access as a text-type logical file. Note that you must enter this ASSIGN command 
before you run your C program.
Invocation of Constructors for Global and Static Variables
During the startup of a C++ program, the constructors for global and static variables 
are invoked. Global and static variables have storage class static, which means that 
they retain their values throughout the execution of the entire program. All global 
variables have storage class static. Local variables and class members can be 
given storage class static by explicit use of the static storage class specifier.
Accessing Environment Information
You can access the environment information saved by the C library during program 
startup:
•
By calling the getenv() library function
•
By declaring parameters to the function main()
The getenv() function enables your program to access the environment array. The 
parameters to main() enable your program to access both the environment and 
argument arrays. Refer to the Guardian TNS C Library Calls Reference Manual, 
Guardian Native C Library Calls Reference Manual, or the Open System Services 
Library Calls Reference Manual for details on how to use the getenv() function; the 
next subsection shows you how to declare parameters to main().
Parameters to the Function main
C enables you to declare up to three parameters to your program’s main function.
argc
is an integer value specifying the number of elements in the argument array argv.
int main(int argc, char *argv[], char *env[]);










