Section 2: Compiler
93
TI
-
89 / TI
-
92 Plus Sierra C Assembler Reference Manual
Not for Distribution
Beta Version February 2, 2001
Typically, the binary search algorithm is more compact than the jump table, and
the jump table algorithm is faster than the binary search. When speed is more
important than size, dummy case statements can be added to the switch
statement in order to force the use of a jump table.
By default, jump tables use a word offset to specify the location of the code
associated with a particular case label. The word table handles most switch
statements likely to be encountered. In the unlikely event that the distance
between the jump table and the code associated with a case label is greater than
32767, the
-Xl
(X el) command line flag can be specified to force the jump table
to use long offsets.
2.16.
The C Preprocessor
The C preprocessor is a simple but powerful macro processor that manipulates
the text of a C source program before it is passed onto the compiler proper. The
preprocessor is typically used to simplify both the writing and maintenance of a C
source program. Controlled by preprocessor directives embedded in the source
file, the preprocessor can do the following:
1. Insert the contents of other files in the source.
2. Conditionally suppress portions of the source.
3. Make macro substitutions in the text.
The directives and operators recognized by the preprocessor are as follows:
#define
#endif
#include
defined
#elif
#if
#line
#
#error
#ifdef
#pragma
##
#else
#ifndef
#undef
All preprocessor directives begin with a pound sign ( # ) and occupy a single
source line. The ' # ' character is permitted to be preceded and/or followed by
whitespace (i.e., tabs, spaces, and comments). A single source line can be
extended to include multiple lines in the file by inserting a backslash ( \ ) before
all but the last newline.
Character sequences recognized as tokens by the preprocessor are: header
names within a #include directive, identifiers, constants, string literals,
punctuation, and non-whitespace characters that are not one of the previously
mentioned.