.nf .in 8 .rm 74 .he c99 Compiler Specifications (Revised 86/04/08) A : Features of c99 c99 currently supports: 1. Data type declarations of: "char" (8 bits) "int" (16 bits) pointers to either of the above by using an "*" before the variable name. initializers on declarations for global variables. The storage class of a declaration is implicitly determined by its position. Declarations occurring outside of any function are global (static) while declarations occurring inside a function definition are local (auto). 2. Arrays: One-dimensional arrays may be of type char or int. 3. Expressions: unary operators: "-" (minus) "*" (indirection) "&" (address of) "~" (ones complement) "!" (logical negation) "++" (increment, either prefix or postfix) "--" (decrement, either prefix or postfix) binary operators: "+" (addition) "-" (subtraction) "*" (multiplication) "/" (division) "%" (modulo, ie. remainder from division) "|" (bitwise inclusive or) "^" (bitwise exclusive or) "&" (bitwise and) "==" (test if equal) "!=" (test if not equal) "<" (test if less than) "<=" (test if less or equal) ">" (test if greater than) ">=" (test if greater or equal) "<<" (arithmetic left shift) ">>" (arithmetic right shift) "=" (assignment) expression , expression primaries: array[expression] function(arg1,arg2,...,argn) constant decimal number quoted string ("sample string") primed string ('a' or 'ab') (the \ character constant is supported) local variable or pointer global (static) variable or pointer 4. Program control: if(expression) statement; if(expression) statement; else statement; while(expression) statement; do statement while(expression); for(expression1;expression2;expression3)statement; switch(expression) statement; case constant : default : break; continue; return; return expression; ; (null statement) { statement; statement; ... } (compound statement) 5. Pointers: Local and static pointers can contain the address of char or int data elements. 6. Compiler commands: #define name string (pre-processor will replace name with string) #include "filename" (take input from filename until end-of-file. cannot be nested.) #asm (not in standard C) (allows all code between "#asm" and "#endasm" to be passed unchanged to the assembler. this command is actually a statement and may be used as: "if (expression) #asm ... #endasm else ...") 7. Miscellaneous: Expression evaluation maintains the same heirarchy as in standard C. Pointer arithmetic recognizes the data type of the destination. ptr++ will increment by 2 if ptr was declared "int *ptr". Pointer compares are unsigned since addresses are not signed numbers. Operations which require more than two words of instructions generate calls to routines in the CSUP library to minimize the size of the program. all such support routines have names beginning with C$. The underscore character (_) is translated to # so that generated labels will be recognized by the assembler. The generated code is re-entrant as required by C. Each time a function is referenced, the local variables refer to a fresh area of the stack. B : Limitations of c99 c99 does not support: 1. Structures, unions and multidimensional arrays. 2. Constant expressions in initializers, case and as array bounds (constants must be used). 3. Data types other than "char" and "int". 4. Function calls returning other than "int" values. 5. The unary "sizeof" and casts. 6. The operators: &&, ||, ?:. 7. The assignment operators: +=, -=,*=, /=, %=, >>=, <<=, &=, ^=, |=. 8. Storage classes: auto, static, extern, register and typedef. 9. The goto statement. 10. The use of arguments within a "#define" command. 11. Conditional compilation (#ifdef, etc). 12. Pointers to anything but char or int. 13. Arrays of pointers. 14. \ followed by ' in a primed string or " in a quoted string. c99 programs may have a maximum of: 1. 1000 characters of macro (#define) definitions. 2. 200 global symbols (variable and function names, including functions external to the program). 3. 40 local symbols within a single function definition. 4. 20 simultaneously active loops (while, for, do). 5. 60 cases within any one switch. 6. 4096 characters of literal strings ("string") within a single function definition or initializer. Other limitations of c99: Since c99 is a single-pass compiler, undefined names are not detected and are assumed to be function or variable names not yet defined. If this assumption is incorrect, an undefined reference error will occur when the compiled program is assembled. Because a single-pass compiler scans the source code only once, very little object code optimization is possible. For example, the statement x=1+2; results in code to add 1 and 2 at runtime. Names may be of any length but the compiler only recognizes the first six characters. REF directives are generated for functions in the CSUP library only. REFs to functions in other libraries must be provided explicitly using #asm and #endasm. The include file STDIO contains REFs for all functions in the CFIO library. The file I/O library (CFIO) is limited to processing Display type files. Tom Bentley of Ottawa, Ontario has written an excellent I/O function library which supports Internal files. Global variables which are not specifically initalized have an indeterminate value at program start. €†€Æ†Ž‘ž¨²¼ÕÕÕÕÕÕÕÕÕ€†