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

 

HP C

HP C
Language Reference Manual


Previous Contents Index

B.43 Linkage Pragmas

HP C supports the #pragma linkage and #pragma use_linkage preprocessor directives on OpenVMS Alpha systems.

These pragmas are used for defining special linkage characteristics and to associate these linkage characteristics with functions. See your platform-specific HP C documentation for more information.

B.44 Other Pragmas

The following pragmas are provided for VAX C compatibility mode only:


        #pragma dictionary CDD_path 
        #pragma module title ident 

These pragmas correspond to the #dictionary and #module directives, respectively.

See your platform-specific HP C documentation for additional pragmas supported on your system.


Appendix C
ASCII Equivalence Table

Figure C-1 shows the ASCII character set. Each character's octal, decimal, and hexadecimal value is shown.

Figure C-1 ASCII Equivalence Chart



Appendix D
Common C Extensions Supported by HP C

HP C supports several common C (old-style C) extensions to ANSI-standard C. These extensions are recognized only when the common C compatibility option is used on the compiler command line. The common C extensions allow you to use the c89 compiler to compile code originally written for the portable C compiler (pcc).

The following sections describe the common C extensions available with the common C compatibility option. Extensions to the ANSI-standard C language are divided into two categories:

  • Extensions compatible with ANSI C programs that produce diagnostic messages when compiled without the common C compatibility option
  • Extensions incompatible with ANSI C programs, which could produce different compiler behavior when used without the common C compatibility option

D.1 Extensions Compatible with ANSI C

  • Relaxed pointer and pointer/integer compatibility is allowed. That is, all pointer and integer types are compatible, and pointer types are compatible with each other regardless of the type of object they point to. Therefore, under the common C option, a pointer to float is compatible with a pointer to int .
  • The digits 8 and 9 are valid in octal integer constants. (A warning message is issued by the compiler, however.)
  • Bit-field data types may include enum , short , char , and long . The ANSI C Standard allows only int , unsigned int , or signed int .
  • long float is recognized as a synonym for double .
  • A third argument to the function main() , namely char *envp[] , is allowed. 1
    When HP C is run in common C compatibility mode, the main function can accept a third parameter, the environment array envp. This array contains process information such as the user name and controlling information, and has no bearing on passing command-line arguments. Its primary use is during exec and getenv library function calls.
    See your platform-specific HP C documentation for more information about invoking the main function within your host environment.
  • Text is allowed following the preprocessing directives #else and #endif .
  • Address constants may be cast to int .
  • Tentative definitions that exist at the completion of a compilation remain tentative to the linker, in accordance with the traditional model of definition resolution.
  • Casts that do not cause a change in representation are legal as lvalues.
  • Implicit function declarations are created at file level, rather than at block level.
  • The types int and long are compatible.
  • Taking the address of a variable with the register storage class is allowed.
  • Block-level declarations of functions with static storage class are allowed.
  • In array types, the element types are allowed to be incomplete.
  • The type of a tentatively-defined variable is allowed to be incomplete at the end of the compilation unit. A warning is issued for this case.
  • Values in case labels are allowed to have a pointer type.
  • Trailing (extra) commas are allowed in enumeration lists.
  • The semicolon following the last structure or union member may be omitted.
  • Carriage returns are accepted and treated as white space.

Note

1 Parameters to the function main() are only checked in strict ANSI mode.

D.2 Extensions Incompatible with ANSI C

  • Unsigned preserving rules apply. ( unsigned char and unsigned short promote to unsigned int .)
  • Comments are converted to no spaces instead of a single space to allow token concatenation. (The compiler attempts to concatenate the two adjacent tokens.)
  • All extern objects have file scope.
  • Macro parameters are recognized and replaced within string or character constants in the macro definition.
  • During macro replacement, an argument's preprocessing tokens are not macro replaced before the macro is expanded.
    If the name of a macro being replaced is found during the rescan of the replacement list, it is macro replaced.
  • Support for predefined macro names that do not conform to the ANSI C Standard (that is, that do not start with two underscores or an underscore followed by a capital letter).
  • A preprocessor directive is only recognized as such if the beginning # character occurs in the first column of a line. Any preprocessor directives preceded by white space are ignored.
  • #ifdef is treated as " #if defined "
  • #ifndef is treated as " #if !defined "
  • Comments in macro replacement lists behave like ## operators when a valid token results after concatenation, except that adjoining white space is not deleted. If the resulting token is not valid, the comment in a macro replacement is deleted.
  • Trigraphs are not recognized and replaced.


Appendix E
VAX C Extensions Supported by HP C

HP C supports several VAX C extensions to ANSI-standard C. These extensions are recognized only when the VAX C compatibility option is used on the compiler command line. The VAX C extensions allow you to use the HP C compiler to compile code originally written for the VAX C compiler.

The following sections describe the VAX C extensions available with the VAX C compatibility option. Extensions to the ANSI-standard C language are divided into two categories:

  • Extensions compatible with ANSI C programs that produce diagnostic messages when compiled without the VAX C compatibility option
  • Extensions incompatible with ANSI C programs, which could produce different compiler behavior when used without the VAX C compatibility option

E.1 Extensions Compatible with ANSI C

  • VAX C specific pragmas are recognized.
  • Relaxed pointer and pointer/integer compatibility is allowed. That is, all pointer and integer types are compatible, and pointer types are compatible with each other regardless of the type of object they point to. Therefore, under the VAX C option, a pointer to float is compatible with a pointer to int .
  • The #module directive is allowed. (On Tru64 UNIX systems this directive produces a warning message and is ignored.)
  • The #dictionary directive is allowed. (On Tru64 UNIX systems this directive produces a warning message and is ignored.)
  • The module form of #include is allowed. (On Tru64 UNIX systems the module form of this directive produces an error.)
  • Specifying int for the type of a bit field is equivalent to specifying signed int in VAX C mode.
  • Built-in functions are recognized.
  • The main_program option may be used to identify a particular function as the main function for a given program.
    When compiling in VAX C mode, another way to specify the main function in a program is to include the following option in the function definition:


    main_program 
    

    This option is not a keyword, and it can be written uppercase or lowercase. The main_program option is useful for allowing a name other than main for the main program.
    In a prototype-style function definition, include main_program between the function declaration part and the left brace, as in the following example:


    char lower(int c_up) 
    main_program 
    { 
       .
       .
       .
    } 
    

    In an old-style function definition, include main_program in the same place as in the prototype style, but before any parameter declarations, as in the following example:


    char lower(c_up) 
    main_program 
    int c_up; 
    { 
       .
       .
       .
    } 
    

    Both examples establish the function lower as the main function; execution begins there, regardless of the order in which the functions are linked.

  • Bit-field data types may include enum , short , char , and long . The ANSI C standard allows only int , unsigned int , or signed int .
  • The last member of a structure may be an array with no size specified.
  • Two struct types or two union types are considered the same type if their sizes are the same.
  • Block-level declarations of functions with static storage class are allowed.
  • The address of a constant may be passed to a function.
  • Taking the address of a variable with register storage class is allowed.
  • A third argument to the function main() , namely char *envp[] , is allowed.
    When HP C is run in VAX C compatibility mode, the main function can accept a third parameter, the environment array envp. This array contains process information such as the user name and controlling information, and has no bearing on passing command-line arguments. Its primary use is during exec and getenv library function calls. 1
    See your platform-specific HP C documentation for more information about invoking the main function within your host environment.
  • long float is recognized as a synonym for double .
  • Character constants containing multiple characters are packed in little endian order. For example, 'AB' is treated as 'B' << 8 + 'A' instead of 'A' << 8 + 'B'.
  • Trailing (extra) commas are allowed in enumeration lists.
  • The element type of an array may be incomplete.
  • Carriage returns are accepted and treated as white space.

Note

1 Parameters to the function main() are only checked in strict ANSI mode.

E.2 Extensions Incompatible with ANSI C

  • Unsigned preserving rules apply. ( unsigned char and unsigned short promote to unsigned int .)
  • VAX C-specific predefined macros are recognized.
  • VAX C-specific keywords are recognized.
  • Macro parameters are recognized and are replaced as string or character constants in the macro definition.
  • Comments are converted to no spaces instead of a single space to allow token concatenation. (The compiler attempts to concatenate the two adjacent tokens.)
  • Comments in macro replacement lists behave like ## operators when a valid token results after concatenation, except that adjoining white space is not deleted. If the resulting token is not valid, the comment in a macro replacement is deleted.
  • Trigraphs are not recognized or replaced.
  • Variant structures and unions are allowed.
    Variant structure and union declarations allow reference to members of nested aggregates without having to refer to intermediate structure or union identifiers. When a variant structure or union declaration is nested within another structure or union declaration, the enclosed variant aggregate ceases to exist as a separate aggregate, and HP C copies its members to the enclosing aggregate.
    Variant structures and unions are declared using the variant_struct and variant_union keywords. The format of these declarations is the same as that for regular structures or unions, with the following exceptions:
    • Variant aggregates must be nested within other valid structure or union declarations.
    • A tag cannot be used in a variant aggregate declaration.
    • At least one member must be declared in the variant aggregate declaration, and it may not be declared as a pointer or an array.

    Initialization of a variant structure or union is the same as that of a normal structure or union.
    With the VAX C compatibility option, two structures or unions in an assignment operation need only have the same size, rather than requiring the same members and member types.
    The following example shows the format of a variable structure declaration, and how to reference members of a variant structure:


    #include <stdio.h> 
    enum packet_type {TEXT, INTEGER}; 
     
    /* This structure can contain either a text_packet  or an integer value.   
       It can only contain one of these at a time, since they share the same 
       storage. */  
     
    struct packet 
    { 
        enum packet_type type; 
        variant_union 
        { 
            variant_struct 
            {    
                int str_size; 
                char *text; 
            } text_packet; 
            variant_struct 
            { 
              int value; 
            } value_packet; 
         
         } text_or_int; 
    } packet = {TEXT, 24 ,"I love the color purple"}; 
     
    main() 
    { 
     
        if (packet.type == TEXT) 
            printf(" %s. \n",packet.text); 
        else 
            printf(" %d \n", packet.value); 
     
        packet.type = INTEGER; 
        packet.value = 42; 
     
        printf(" The meaning of life, the universe, and everything is: %d. \n", 
    packet.value); 
     
    } 
    


Appendix F
Universal Character Names for Identifiers

The following table lists the hexadecimal code values that are valid in universal character names in identifiers. Ranges that are part of the basic character sets are omitted.


Latin:         00AA, 00BA, 00C0-00D6, 00D8-00F6,  00F8-01F5, 
               01FA-0217,  0250-02A8,  1E00-1E9B, 1EA0-1EF9, 
               207F 
 
Greek:         0386, 0388-038A, 038C, 038E-03A1,  03A3-03CE, 
               03D0-03D6, 03DA, 03DC, 03DE, 03E0, 03E2-03F3, 
               1F00-1F15, 1F18-1F1D,  1F20-1F45,  1F48-1F4D, 
               1F50-1F57,   1F59,   1F5B,  1F5D,  1F5F-1F7D, 
               1F80-1FB4, 1FB6-1FBC,  1FC2-1FC4,  1FC6-1FCC, 
               1FD0-1FD3,  1FD6-1FDB,  1FE0-1FEC, 1FF2-1FF4, 
               1FF6-1FFC 
 
Cyrillic:      0401-040C, 040E-044F,  0451-045C,  045E-0481, 
               0490-04C4,  04C7-04C8,  04CB-04CC, 04D0-04EB, 
               04EE-04F5, 04F8-04F9 
 
Armenian:      0531-0556, 0561-0587 
 
Hebrew:        05B0-05B9,   05BB-05BD,   05BF,    05C1-05C2, 
               05D0-05EA, 05F0-05F2 
 
Arabic:        0621-063A,  0640-0652,  0670-06B7, 06BA-06BE, 
               06C0-06CE, 06D0-06DC, 06E5-06E8, 06EA-06ED 
 
Devanagari:    0901-0903, 0905-0939,  093E-094D,  0950-0952, 
               0958-0963 
 
Bengali:       0981-0983,  0985-098C,  098F-0990, 0993-09A8, 
               09AA-09B0,   09B2,   09B6-09B9,    09BE-09C4, 
               09C7-09C8,  09CB-09CD,  09DC-09DD, 09DF-09E3, 
               09F0-09F1 
 
Gurmukhi:      0A02,   0A05-0A0A,   0A0F-0A10,    0A13-0A28, 
               0A2A-0A30,  0A32-0A33,  0A35-0A36, 0A38-0A39, 
               0A3E-0A42, 0A47-0A48,  0A4B-0A4D,  0A59-0A5C, 
               0A5E, 0A74 
 
Gujarati:      0A81-0A83,    0A85-0A8B,   0A8D,   0A8F-0A91, 
               0A93-0AA8, 0AAA-0AB0,  0AB2-0AB3,  0AB5-0AB9, 
               0ABD-0AC5, 0AC7-0AC9, 0ACB-0ACD, 0AD0, 0AE0 
 
Oriya:         0B01-0B03,  0B05-0B0C,  0B0F-0B10, 0B13-0B28, 
               0B2A-0B30, 0B32-0B33,  0B36-0B39,  0B3E-0B43, 
               0B47-0B48, 0B4B-0B4D, 0B5C-0B5D, 0B5F-0B61 
 
Tamil:         0B82-0B83,  0B85-0B8A,  0B8E-0B90, 0B92-0B95, 
               0B99-0B9A,   0B9C,   0B9E-0B9F,    0BA3-0BA4, 
               0BA8-0BAA,  0BAE-0BB5,  0BB7-0BB9, 0BBE-0BC2, 
               0BC6-0BC8, 0BCA-0BCD 
 
Telugu:        0C01-0C03, 0C05-0C0C,  0C0E-0C10,  0C12-0C28, 
               0C2A-0C33,  0C35-0C39,  0C3E-0C44, 0C46-0C48, 
               0C4A-0C4D, 0C60-0C61 
 
Kannada:       0C82-0C83, 0C85-0C8C,  0C8E-0C90,  0C92-0CA8, 
               0CAA-0CB3,  0CB5-0CB9,  0CBE-0CC4, 0CC6-0CC8, 
               0CCA-0CCD, 0CDE, 0CE0-0CE1 
 
Malayalam:     0D02-0D03, 0D05-0D0C,  0D0E-0D10,  0D12-0D28, 
               0D2A-0D39,  0D3E-0D43,  0D46-0D48, 0D4A-0D4D, 
               0D60-0D61 
 
Thai:          0E01-0E3A, 0E40-0E5B 
 
Lao:           0E81-0E82,  0E84,  0E87-0E88,   0E8A,   0E8D, 
               0E94-0E97,  0E99-0E9F, 0EA1-0EA3, 0EA5, 0EA7, 
               0EAA-0EAB, 0EAD-0EAE,  0EB0-0EB9,  0EBB-0EBD, 
               0EC0-0EC4, 0EC6, 0EC8-0ECD, 0EDC-0EDD 
 
 
Tibetan:       0F00, 0F18-0F19, 0F35, 0F37, 0F39, 0F3E-0F47, 
               0F49-0F69, 0F71-0F84,  0F86-0F8B,  0F90-0F95, 
               0F97, 0F99-0FAD, 0FB1-0FB7, 0FB9 
 
Georgian:      10A0-10C5, 10D0-10F6 
 
Hiragana:      3041-3093, 309B-309C 
 
Katakana:      30A1-30F6, 30FB-30FC 
 
Bopomofo:      3105-312C 
 
CJK Unified Ideographs: 4E00-9FA5 
 
Hangul:        AC00-D7A3 
 
Digits:        0660-0669,  06F0-06F9,  0966-096F, 09E6-09EF, 
               0A66-0A6F, 0AE6-0AEF,  0B66-0B6F,  0BE7-0BEF, 
               0C66-0C6F,  0CE6-0CEF,  0D66-0D6F, 0E50-0E59, 
               0ED0-0ED9, 0F20-0F33 
 
Special characters:   00B5, 00B7, 02B0-02B8, 02BB,  02BD-02C1, 
                      02D0-02D1, 02E0-02E4, 037A, 0559, 093D, 0B3D, 
                      1FBE, 203F-2040, 2102, 2107, 210A-2113, 2115, 
                      2118-211D,   2124,   2126,  2128,  212A-2131, 
                      2133-2138, 2160-2182, 3005-3007, 3021-3029 


Index Contents

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