Jump to 
content
HP.com Home Products and Services Support and Drivers Solutions How to Buy
»  Contact HP

 

HP C

HP C
User's Guide for OpenVMS Systems


Previous Contents Index

E1, E2, and E3 are valid C expressions. E1 is evaluated, and if it is nonzero, the result is the value of E2; otherwise, the result is the value of E3. Either E2 or E3 is evaluated, but not both.

constant: A primary expression whose value does not change. A constant may be literal or symbolic.

constant expression: An expression involving only constants. Constant expressions are evaluated at compile time so they may be used wherever a constant is valid.

conversion: The changing of a value from one data type to another. Conversions take place in assignments by changing the type of the right operand's result to that of the object referred to by the left operand; the resultant type also applies to the assignment expression. Conversions are also performed when arguments are passed to functions: char and short become int ; unsigned char and unsigned short become unsigned int if no function prototype is in scope; float becomes double . Conversions can also be forced by means of a cast. Conversions are performed on operands in arithmetic expressions by the arithmetic conversions.

conversion characters: A character used with the HP C RTL Standard I/O functions that is preceded by a percent sign (%) and specifies an input or output format. For example, letter d instructs the function to input/output the value in a decimal format.

Curses: A screen management package comprised of HP C RTL functions and macros that create and modify defined sections of the terminal screen, and optimize cursor movement. Curses defines rectangular regions on the terminal display that you may write upon, rearrange, move to new positions on the screen, and delete from the screen. These rectangular regions are called windows. To use any of the Curses functions or macros, you must include the <curses.h> header file using the #include preprocessor directive.

data definition: The syntax that both declares the data type of an object and reserves its storage. For variables that are internal to a function, the data definition is the same as the declaration. For external variables, the data definition is external to any function (an external data definition).

data-type modifier: Keywords that affect the allocation or access of data storage. The two data-type modifiers are const and volatile .

declaration: A statement that gives the data type and possibly the storage class of one or more variables.

DEC/Shell: An optional OpenVMS software product available under a separate license that is a command-language interpreter based on the UNIX Version 7.0 Bourne Shell with commands for interactive program development, device and data file manipulation, and interactive and batch execution. DEC/Shell RTL functions were added to the HP C RTL so that valid DEC/Shell file specifications could be used in HP C for OpenVMS source programs. See also file specification.

dictionaries: A hierarchical organization, similar to the organization of directories and subdirectories, of data structure definitions in the CDD/Repository. See also CDD/Repository.

directives: See preprocessor directives.

elements: Members of an array. See also aggregate.

enumerated type: A type defined (with the enum keyword) to have an ordered set of integer values. The integer values are associated with constant identifiers named in the declaration. Although enum variables are stored internally as integers, use them in programs as if they have a distinct data type named in the enum declaration.

equality operator: One of the operators equal to ( == ) or not equal to (!=). They are similar to the relational operators, but at the next lower level of precedence.

exponentiation operator: The C language does not have an exponentiation operator. Use the HP C RTL function exp .

expression: A series of characters that the compiler can use to produce a value. Expressions have one or more operands and, usually, one or more operators. An identifier with no operator is an expression that yields a value directly. Operands are either identifiers (such as variable names) or other expressions, which are sometimes called subexpressions. See also operator and macro.

external storage class: A storage class that permits identifiers to have a link-time scope that can possibly span object modules. Identifiers of this storage class are defined outside of functions using no storage-class specifier, and are declared, optionally, throughout the program using the extern specifier. External variables provide a means other than argument passing for exchanging data between the functions that comprise a C program. See also link-time scope.

file descriptor: In the UNIX environment, the integer that identifies a file.

file specification: An identifier that specifies an existing file. There are two types of valid file specifications in HP C: OpenVMS specifications and DEC/Shell specifications. DEC/Shell specifications are a subset of UNIX specifications.

floating type: One of the data types float or double , representing a single- or double-precision, floating-point number. There are two implementations of the data type double : D_floating and G_floating. The range of values for the D_floating variables is the same as that for float variables, but the precision is 16 decimal digits, as opposed to 7. Programs that use G_floating variables must use the /FLOAT=G_FLOAT (or /G_FLOAT) command-line qualifier. A G_floating variable has considerably greater range, but has less precision.

function: The primary unit from which C programs are constructed. A function definition begins with a name and parameter list, followed by the declarations of the parameters (if any) and the body of the function enclosed in braces ({ }). The function body consists of the declarations of any local variables and the set of statements that perform its action. Functions do not have to return a value to the caller. All C functions are external; that is, a function may not contain another function. See also function call.

function call: A primary expression, usually a function identifier followed by parentheses, that is used to invoke the function. The parentheses contain a (possibly empty) comma-separated list of expressions that are the arguments to the function. Any previously undeclared identifier followed immediately by parentheses is declared as a function returning int . Any function may call itself recursively.

function inline expansion: A replacement of a function call with code that performs the actions of the defined function. This process reduces execution time. By default, HP C attempts to expand inline all functions. You can use the #pragma inline directive to provide inline expansion for functions that HP C does not expand inline by default. See also pragma.

function unrolling: See function inline expansion.

fundamental type: The set of arithmetic data types plus pointers. In general, the fundamental types comprise those data types that can be represented naturally on a VAX processor; usually, this means integers and floating-point numbers of various machine-dependent sizes, and machine addresses.

global storage class: A storage class that permits identifiers to have a link-time scope that can possibly span object modules. Identifiers of this storage class are defined using the globaldef storage-class specifier, and are declared, optionally, throughout the program using the globalref specifier. You can use the globalvalue specifier to define a global symbol, or constant. Global variables provide a means other than argument passing for exchanging data between the functions that comprise a HP C program. See also link-time scope.

identifier: A sequence of letters and digits, the first 255 of which must be unique. The underscore (_) and dollar sign ($) are letters in this context. The first character of an identifier must be a letter. Upper- and lowercase letters specify different identifiers in HP C. However, all external names are converted to uppercase to be consistent with the OpenVMS environment and are only 31 characters in length.

initializer: The part of a declaration that gives the initial value(s) for the preceding declarator. An initializer consists of an equal sign (=) followed by either a single expression or a comma-separated list of one or more expressions in braces.

inline expansion: See function inline expansion.

integral type: One of the data types char or int (all sizes, signed or unsigned).

internal storage class: A storage class that permits identifiers declared inside of a function body to be recognized only from the declaration to the end of the immediately enclosing block. Identifiers of the internal storage class are declared using the auto and register storage-class specifiers. See also scope.

keyword: A character string that is reserved by the C language and cannot be used as an identifier. Keywords identify statements, storage classes, data types, and the like. Library function names are not C keywords; you may redefine function names.

lexical scope: The area in which the compiler recognizes a declared identifier within a given compilation unit. See also scope.

License Management Facility (LMF): A process by which you register and use some HP software products. See your HP C installation guide for more information.

lifetime: The length of time for which storage for a variable is allocated. See also external storage class, internal storage class, and program section (psect).

link libraries: The libraries searched by the OpenVMS Linker to resolve external references. Depending on the needs of your program, you have to specify certain libraries in a specific order so that your program links properly. For more information, see Chapter 1.

link-time scope: The area in which the OpenVMS Linker recognizes an identifier within a given program. See also scope.

literal: A constant whose value is written explicitly in the program. Literal values have type int or double , depending on their forms. Character constants have type int . Floating constants have type double . Character-string constants have type array of char .

local variable: A variable declared inside a function body. See also internal storage class.

logical expression: An expression made up of two or more operands separated by a logical operator. Each operand must be a fundamental type or must be a pointer or other address expression. Operands do not have to be the same type. Logical expressions always return 1 or 0 (type int ) to indicate a true or false value, respectively. Logical expressions are always evaluated from left to right, and the evaluation stops as soon as the result is known.

logical operator: One of the binary operators logical AND (&&) and logical OR (||).

loop: A construct that executes a single statement or a block repeatedly until a given expression evaluates to false. The single statement or block is called the loop body. The C language has three types of loops: one that evaluates the expression before executing the loop body (the while statement), one that evaluates the expression after executing the loop body (the do statement), and one that executes the loop body a specified number of times (the for statement).

lvalue: The address in memory that is the location of an object whose contents can be assigned or modified. In this guide, the term describes a category in C grammar. An expression evaluating to an lvalue is required on the left side of an assignment operator (hence its name) and as the operand of certain other operators, such as the increment (++) and decrement ( - - ) operators. A variable name is an example of an expression evaluating to an lvalue, since its address can be taken (with &), and values can be assigned to it. A constant is an example of an expression that is not an lvalue. See also rvalue.

macro: A text substitution that is defined with the #define preprocessor directive and can include a list of parameters. The parameters in the #define directive are replaced at compile time with the corresponding arguments from a macro reference encountered in the source text.

main_program option: A tag that can be placed on a separate line between the function parameter list and the rest of a function definition to tell the OpenVMS image activator to begin program execution with this function. You can use the main_program identifier when there is no function named main ; it is not a keyword; it can be spelled in upper- or lowercase; and it is specific to HP C for OpenVMS Systems.

members: Segments of the aggregate data structures (arrays, structures, or unions) that are declared to be of either scalar or aggregate data type. See also aggregate.

module:

  • The object code produced and placed into a file with a .OBJ extension after a compilation unit has been compiled. The object file is the file name with the .OBJ extension; the object module is the system-recognized name (usually the same as the object-file name without an extension).
  • A segment of object code located in an object library.

multiplication operator: An operator that performs multiplication (*), division (/), or modular arithmetic (%). If necessary, it performs the arithmetic conversions on its operands. The mod operator (%) yields the remainder of the first operand divided by the second.

null pointer: A pointer variable that has not been assigned an lvalue and whose value has been initialized to 0. If you use a null pointer in an expression that needs a value, the compiler will let you try to access memory location 0, which will cause the ACCVIO hardware error. The NULL macro can be used when comparing for a null pointer. It is defined in both the <stdio.h> and <stddef.h> header files as follows:


(void *) 0 

null character: The escape sequence (\0) that HP C uses to terminate all character strings. The NULL macro can be used when comparing for null characters. It is defined in both the <stdio.h> and <stddef.h> header files as follows:


(void *) 0 

object: Data stored at a location in memory represented by an identifier. Objects are one of the basic elements that the language can manipulate; that is, the elements to which operators can be applied. In C, objects include data (such as integers, real numbers, or characters), data structures (arrays, structures, or unions), and functions.

occlude: In the Curses Screen Management package, when the area of one defined window overlaps the area of another defined window on the terminal screen. See also Curses.

operator: A character that performs an operation on one or more operands. In order of precedence (high to low), operators are classified as the primary-expression operators, unary operators, binary operators, the conditional operator, assignment operators, and the comma operator.

parameter: A variable listed in the parentheses and declared between the function identifier and body in the function definition. The parameter receives a copy of the value of an associated argument when the function is called. The items in parentheses in a macro definition are also called parameters, but the semantics are different from C function calls.

pointer: A variable that contains the address (lvalue) of another variable or function. A pointer is declared with the unary asterisk operator (*).

portability: The ability to compile an unaltered C source program on several operating systems and machines; in this guide particularly, between UNIX and OpenVMS systems.

pragma: A preprocessor directive that produces implementation-specific results. Certain pragmas may not be portable, but other compilers may support pragmas that are supported by HP C for OpenVMS Systems. See also preprocessor directives.

precedence of operators: The order in which operations are performed. If an expression contains several operators, the operations are executed in the following order: primary expression operators, unary operators, binary operators, the conditional operator, assignment operators, and the comma operator.

preprocessor directives: Lines of text in a C source file that change the order or manner of subsequent compilation. The directives are #define , for macro substitution and other replacements; #undef , to cancel a previous #define ; #include , to include an external source text; #line , to specify a line number to the compiler; #module , to specify a module name to the linker; #dictionary , to extract data structures from the Common Data Dictionary; #pragma , to give the compiler implementation-specific information; and #if , #ifdef , #ifndef , #else , #elif , #endif , to place conditions on the compilation of sections of a program. In HP C, these directives are processed by an early phase of the compiler, not by a separate program.

primary expression: An expression that contains only a primary-expression operator or no operator. Primary expressions include previously declared identifiers, constants, strings, function calls, subscripted expressions, and references to structure or union members.

primary-expression operator: An operator that qualifies a primary expression. The set of such operators consists of paired brackets ([ ]) to enclose a single subscript; paired parentheses (( )) to enclose an argument list or to change the associative precedence of operators; a period (.) to qualify a structure or union name with the name of a member; and an arrow (-->) to qualify a structure or union member with a pointer or other address-valued expression.

program section (psect): An area of virtual memory that has a name, a size, and a series of attributes that describe the intended or permitted usage of that permanent variable. Variables of type static , and of all external and global types are placed in psects. See also lifetime.

refresh: A Curses Screen Management term describing the updating of the terminal screen so that the latest contents of defined windows are placed on the screen. No edits made to any window can appear on the terminal screen until you refresh the window on the screen using refresh , wrefresh , or touchwin . See also Curses.

relational operator: One of the operators less than (<), greater than (>), less than or equal to (<=), or greater than or equal to (>=). The result (which is of type int ) is 1 or 0, indicating a true or false relation, respectively. If necessary, the arithmetic conversions are performed on the two operands. Relational operators group from left to right.

run-time library: In HP C for OpenVMS Systems, the group of common functions and macros that accompany the compiler that may be called to perform I/O tasks, character-string manipulation, math tasks, system calls, and various other tasks. The C language includes no facilities to administer I/O, so compilers include run-time libraries to provide this service. The HP C Run-Time Library (RTL) is shipped with the OpenVMS operating system. You can access the HP C RTL by receiving a copy of the function module in your program's image, or by sharing the function image with your program so that control is passed to the function image and then back to your program. See also shareable image.

rvalue: The object stored at a location in memory represented by an identifier. The rvalue of a variable is the variable's object. See also lvalue and object.

scalar: Single objects, including pointers, that can be manipulated in their entirety, in an arithmetic expression. See also object and aggregate.

scope: The portion of a program in which a particular name has meaning. The link-time scope of names declared in external definitions possibly extends from the point of the definition's occurrence to the end of the program. The scope of the names of function parameters is the function itself. The scope of names declared in any block (that is, after the brace beginning any compound statement) is restricted to that block. Names declared in a block supersede any other declaration of the name, including external definitions, for the extent of that block. Tags within struct , union , typedef , and enum declarations are identifiers that are subject to the same scope rules as any identifiers. Member names in structure or union references are not subject to the same scope rules (see uniqueness). The scope of a label is the entire function containing the label.

shareable image: An OpenVMS image that passes control to another image that passes control back to the original program. You can access the HP C Run-Time Library (RTL) as a shared image; control is passed to the HP C RTL and then back to your program instead of a copy of the function's object module being copied into your program's image.

shift operator: One of the binary operators (<<) or (>>). Both operands must have integral types. The value of the expression E1<< E2 is the result of expression E1 (interpreted as a bit pattern) left-shifted by E2 bits. The value of E1 >>E2 is E1 right-shifted by E2 bits.

statement: The language elements that perform the action of a function. Statements include expression statements (an expression followed by a semicolon), null statements (the semicolon by itself), compound statements (blocks), and an assortment of statements identified by keywords (such as return , switch , and do ).

static storage class: A storage class that permits identifiers to be recognized possibly from the point of the declaration to the end of the compilation unit. Identifiers of the static storage class are declared using the static storage-class specifier. See also scope.

stderr: The predefined file pointer associated with the terminal to report run-time errors. The pointed file is equivalent to the OpenVMS logical SYS$ERROR and the file descriptor 2. To use this definition, include the stdio definition module in your source code using the #include preprocessor directive.

stdin: The predefined file pointer associated with the terminal to perform input. The pointed file is equivalent to the OpenVMS logical SYS$INPUT and the file descriptor 0. For example, if you specify stdin as the pointer to the file to read from in the getc macro, the macro reads from the terminal. To use this definition, include the stdio definition module in your source code using the #include preprocessor directive.

stdout: The predefined file pointer associated with the terminal to perform output. The pointed file is equivalent to the OpenVMS logical SYS$OUTPUT and the file descriptor 1. For example, if you specify stdout as the pointer to the file to write to in the putc macro, the macro writes to the terminal. To use this definition, include the definition module stdio in your source code using the #include preprocessor directive.

storage class: The attribute that, with its type, determines the location, lifetime, and scope of an identifier's storage. Examples are static , external , and auto .

storage-class modifier: Keywords used with the storage-class and data-type keywords to change program section attributes of variables, which restricts access to them. The two storage-class modifiers are noshare and readonly .

string:

  • An array of type char .
  • A constant consisting of a series of ASCII characters enclosed in quotation marks. Such a constant is declared implicitly as an array of char , initialized with the given characters, and terminated by a null character (ASCII 0, HP C escape sequence \0).

structure: An aggregate type consisting of a sequence of named members. Each member may have either a scalar or an aggregate type. A structure member may also consist of a specified number of bits called a bit field.

symbolic constant: An identifier assigned a constant value by a #define directive. You may use a symbolic constant wherever a literal is valid.

tags: Identifiers that represent a declaration of the data types struct , union , or enum . You may use tags in declarations from that point onward in the program to declare other variables of the same type without having to key in the lengthy declaration again.

tokens: The fundamental elements making up the text of a C program. Tokens are identifiers, keywords, constants, strings, operators, and other separators. White space (such as spaces, tabs, new lines, and comments) is ignored except where it is necessary to separate tokens.


Previous Next Contents Index

Privacy statement Using this site means you accept its terms
© 2007 Hewlett-Packard Development Company, L.P.