PAGETURNER
CLEAN
BOX
REVIEW
GO
The C compiler invocation command line to define the constant
UNIX_ON, and to undefine the constant OTHERS_OFF would be:
a cc ... -UUNIX_ON -DOTHERS_OFF
b cc -UUNIX_ON -UOTHERS_OFF ...
c cc -DUNIX_ON ... -UOTHERS_OFF ...
Select one:
That is correct!
You've got it on the 2nd try.
Good, you understand the concept!
Sorry, try again.
No, try one more time.
Please review Topic 3: Defining and Undefining Constants
FORGET2
The correct choice is c . The position of the constant definition
within the command line is irrelevant. In a and b , the logic
is wrong. Recall that -D defines a constant and -U undefines it.
Given the following compiler invocation line:
cc -DVAX=0 -DMC68000=16 update.c
and the following code inside the function update.c:
#ifdef VAX
wordsize = 32;
#else
wordsize = 16;
#ifndef MC68000
clib = "/usr/lib/common";
#else
clib = "/usr/lib/mc68";
#endif
#endif
-------------------------------
The values of wordsize and clib are:
a 16 and "/usr/lib/common" b 32 and "/usr/lib/mc68"
c 32 and "/usr/lib/common" d 16 and "/usr/lib/mc68"
Select one:
That is correct!
You've got it on the 2nd try.
You've got it finally!
Sorry, try again.
No, try one more time.
Please review Topic 5: Conditional Compilation Commands
FORGET3
The correct choice is b . Since both constants VAX and mc68000 are
defined, the ifdef evaluates to TRUE and ifndef evaluates to FALSE.