ID Number: Q69350
6.00 6.00a 6.00ax | 6.00 6.00a
MS-DOS | OS/2
Summary:
SYMPTOMS
If the C version 6.0 sample Presentation Graphics program
CHRTDEMO.C is compiled with the ANSI compatibility switch (/Za),
the following compiler error will be produced:
chrtdemo.h(140) : error C2059: syntax error : '*'
STATUS
This is correct behavior because of the use of the Microsoft
extension "far" found on line 140 of CHRTDEMO.H; /Za disables
extensions specific to Microsoft C.
More Information:
The supplied CHRTDEMO.MAK makefile is set up to use the default
setting of /Ze (Microsoft C extensions enabled). The C2059 error will
only occur if this option is changed to /Za (ANSI compatibility--
Microsoft C extensions disabled). This change can be made either
inside the Programmer's WorkBench from the C Compiler Options dialog
box or by actually modifying the makefile to include /Za in the
compiler flags macro.
According to the ANSI specification, all keywords that are extensions
to the language must begin with a leading underscore. Beginning with C
version 6.0, the Microsoft supplied header files contain this change
to all keywords, such as _far, _pascal, and so on, but the previous
versions of these keywords without the leading underscores are
retained for backwards compatibility.
Most of the sample programs were modified to include the new keywords,
but the line in CHRTDEMO.H was not changed to include _far, instead of
far, thus resulting in the C2059 error with /Za. If you modify the far
keyword on line 140 of CHRTDEMO.H so that it includes a leading
underscore, this will eliminate the C2059 error even when /Za is
specified.
The QuickC compiler shares the same ANSI compatibility mode as the
optimizing compiler, as well as a similar chart example program. Thus,
the same C2059 error may be encountered with /Za in QuickC versions
2.0, 2.01, 2.5, and 2.51.
Additional reference words: 2.00 2.50 6.00 6.0a 6.00a 6.0ax 6.00ax