Chapter Contents

Previous

Next
Compiling C and C++ Programs

Language Extensions

This section introduces the extensions to the ISO/ANSI C language implemented in Release 6.50 of the SAS/C Compiler. Library extensions are described in SAS/C Library Reference, Volume 1, SAS/C Library Reference, Volume 2, and SAS/C Compiler and Library User's Guide.

Note:    Use of these extensions is likely to render a program nonportable.  [cautionend]


Compiler Comment Support

The SAS/C Compiler now supports C++ style line comments. A line comment starts with two forward slashes and goes to the end of the line. An example of the new comment extension is:

     // This is a comment line

Note:    This support is turned off if the -Kstrict compiler option is used.  [cautionend]


Extended @ Operator Capability

Compiler support for the at sign (@) has been extended. When the compiler option -KAT is specified, @ is treated as a new operator. The @ operator can be used only in an argument to a function call. (The result of using it in any other context is undefined.) The @ operator has the same syntax as &. In situations where & can be used, @ has the same meaning as &.

In addition, @ can be used on non-lvalues such as constants and expressions. In these cases, the value of @expr is the address of a temporary storage area to which the value of expr is copied.

One special case for the @ operator is when its argument is an array name or a string literal. In this case, @array is different from &array. While @array addresses a pointer addressing the array, &array still addresses the array.

The compiler continues to process the @ operator as in earlier releases when the @ is in the context of a function call. Use of @ is nonportable. Its use should be restricted to programs that call non-C routines using call-by-reference.


Character and String Qualifiers

Release 6.50 introduces A and E qualifiers for character and string constants. The new qualifiers cause the string to be either ASCII or EBCDIC.

A string literal prefixed with A is parsed and stored by the compiler as an ASCII string. An example of its usage is:

     A"this is an ASCII string"

A string literal prefixed with E is parsed and stored by the compiler as an EBCDIC string. An example of its usage is:

     E"this is an EBCDIC string"


Chapter Contents

Previous

Next

Top of Page

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.