
- •Chapter 1. Introduction
- •Books About the C Language
- •Chapter 2. Compiling with C51
- •Environment Settings
- •Running C51
- •DOS ERRORLEVEL
- •C51 Output Files
- •Control Directives
- •Directive Categories
- •Reference
- •Chapter 3. Language Extensions
- •Keywords
- •8051 Memory Areas
- •Program Memory
- •Internal Data Memory
- •External Data Memory
- •Special Function Register Memory
- •Memory Models
- •Small Model
- •Compact Model
- •Large Model
- •Memory Types
- •Explicitly Declared Memory Types
- •Implicit Memory Types
- •Data Types
- •Bit Types
- •Special Function Registers
- •sbit
- •Absolute Variable Location
- •Pointers
- •Generic Pointers
- •Pointer Conversions
- •Abstract Pointers
- •Function Declarations
- •Function Parameters and the Stack
- •Passing Parameters in Registers
- •Function Return Values
- •Specifying the Memory Model for a Function
- •Specifying the Register Bank for a Function
- •Register Bank Access
- •Interrupt Functions
- •Reentrant Functions
- •Chapter 4. Preprocessor
- •Directives
- •Stringize Operator
- •Predefined Macro Constants
- •Chapter 5. 8051 Derivatives
- •Dallas 80C320, 80C520, and 80C530
- •Siemens 80C517 and 80C537
- •Data Pointers
- •Library Routines
- •Philips/Signetics 8xC750, 8xC751, and 8xC752
- •Customization Files
- •STARTUP.A51
- •START751.A51
- •INIT.A51
- •INIT751.A51
- •PUTCHAR.C
- •GETKEY.C
- •CALLOC.C
- •FREE.C
- •INIT_MEM.C
- •MALLOC.C
- •REALLOC.C
- •Optimizer
- •General Optimizations
- •8051 Specific Optimizations
- •Options for Code Generation
- •Segment Naming Conventions
- •Data Objects
- •Program Objects
- •Interfacing C Programs to Assembler
- •Function Parameters
- •Parameter Passing in Registers
- •Parameter Passing in Fixed Memory Locations
- •Function Return Values
- •Using the SRC Directive
- •Register Usage
- •Overlaying Segments
- •Example Routines
- •Small Model Example
- •Compact Model Example
- •Large Model Example
- •Data Storage Formats
- •Bit Variables
- •Signed and Unsigned Long Integers
- •Generic Pointers
- •Accessing Absolute Memory Locations
- •Absolute Memory Access Macros
- •Linker Location Controls
- •The _at_ Keyword
- •Debugging
- •Chapter 7. Error Messages
- •Fatal Errors
- •Actions
- •Errors
- •Syntax and Semantic Errors
- •Warnings
- •Chapter 8. Library Reference
- •Intrinsic Routines
- •Library Files
- •Standard Types
- •va_list
- •Absolute Memory Access Macros
- •CBYTE
- •CWORD
- •DBYTE
- •DWORD
- •PBYTE
- •PWORD
- •XBYTE
- •XWORD
- •Routines by Category
- •Buffer Manipulation
- •Character Conversion and Classification
- •Data Conversion
- •Math
- •Memory Allocation
- •Stream Input and Output
- •String Manipulation
- •Miscellaneous
- •Include Files
- •8051 Special Function Register Include Files
- •ABSACC.H
- •ASSERT.H
- •CTYPE.H
- •INTRINS.H
- •MATH.H
- •SETJMP.H
- •STDARG.H
- •STDDEF.H
- •STDIO.H
- •STDLIB.H
- •STRING.H
- •Reference
- •Appendix A. Differences from ANSI C
- •Compiler-related Differences
- •Library-related Differences
- •Appendix B. Version Differences
- •Version 4 Differences
- •Version 3.4 Differences
- •Version 3.2 Differences
- •Version 3.0 Differences
- •Version 2 Differences
- •Appendix C. Writing Optimum Code
- •Memory Model
- •Variable Location
- •Variable Size
- •Unsigned Types
- •Local Variables
- •Other Sources
- •Appendix D. Compiler Limits
- •Appendix E. Byte Ordering
- •Recursive Code Reference Error
- •Problems Using the printf Routines
- •Uncalled Functions
- •Trouble with the bdata Memory Type
- •Using Monitor-51
- •Function Pointers
- •Glossary
- •Index

Keil Software — C51 Compiler User’s Guide |
309 |
|
|
Appendix A. Differences from ANSI C
The C51 compiler differs in only a few aspects from the ANSI C Standard. These differences can be grouped into compiler-related differences and library-related differences.
Compiler-related Differences
A
!Wide Characters
Wide 16-bit characters are not supported by C51. ANSI provides wide characters for future support of an international character set.
!Recursive Function Calls
Recursive function calls are not supported by default. Functions that are recursive must be declared using the reentrant function attribute. Reentrant functions can be called recursively because the local data and parameters are stored in a reentrant stack. In comparison, functions which are not declared using the reentrant attribute use static memory segments for the local data of the function. A recursive call to these functions overwrites the local data of the prior function call instance.
Library-related Differences
The ANSI C Standard Library includes a vast number of routines, most of which are included in C51. Many, however, are not applicable to an embedded application and are excluded from the C51 library.
The following ANSI Standard library routines are included in the C51 library:
abs |
cosh |
isgraph |
acos |
exp |
islower |
asin |
fabs |
isprint |
atan |
floor |
ispunct |
atan2 |
free |
isspace |
atof |
getchar |
isupper |
atoi |
gets |
isxdigit |
atol |
isalnum |
labs |
calloc |
isalpha |
log |
ceil |
iscntrl |
log10 |
cos |
isdigit |
longjmp |
|
|
310 |
|
Appendix A. Differences from ANSI C |
|
|
|
|
|
|
|
malloc |
setjmp |
strncmp |
|
|
memchr |
sin |
strncpy |
|
|
|||
A |
|
memcmp |
sinh |
strpbrk |
|
memcpy |
sprintf |
strrchr |
|
|
|
|||
|
|
memmove |
sqrt |
strspn |
|
|
memset |
srand |
tan |
|
|
|||
|
|
modf |
sscanf |
tanh |
|
|
pow |
strcat |
tolower |
|
|
printf |
strchr |
toupper |
|
|
putchar |
strcmp |
va_arg |
|
|
puts |
strcpy |
va_end |
|
|
rand |
strcspn |
va_start |
|
|
realloc |
strlen |
vprintf |
|
|
scanf |
strncat |
vsprintf |
|
|
The following ANSI Standard library routines are not included in the C51 |
||
|
|
library: |
|
|
|
|
abort |
freopen |
rename |
|
|
asctime |
frexp |
rewind |
|
|
atexit |
fscanf |
setbuf |
|
|
bsearch |
fseek |
setlocale |
|
|
clearerr |
fsetpos |
setvbuf |
|
|
clock |
ftell |
signal |
|
|
ctime |
fwrite |
strcoll |
|
|
difftime |
getc |
strerror |
|
|
div |
getenv |
strftime |
|
|
exit |
gmtime |
strstr |
|
|
fclose |
ldexp |
strtod |
|
|
feof |
ldiv |
strtok |
|
|
ferror |
localeconv |
strtol |
|
|
fflush |
localtime |
strtoul |
|
|
fgetc |
mblen |
strxfrm |
|
|
fgetpos |
mbstowcs |
system |
|
|
fgets |
mbtowc |
time |
|
|
fmod |
mktime |
tmpfile |
|
|
fopen |
perror |
tmpnam |
|
|
fprintf |
putc |
ungetc |
|
|
fputc |
qsort |
vfprintf |
|
|
fputs |
raise |
wcstombs |
|
|
fread |
remove |
wctomb |

Keil Software — C51 Compiler User’s Guide |
311 |
|
|
The following routines are not found in the ANSI Standard Library but are included in the C51 library.
acos517 |
_irol_ |
sqrt517 |
asin517 |
_iror_ |
sscanf517 |
atan517 |
log10517 |
strpos |
atof517 |
log517 |
strrpbrk |
cabs |
_lrol_ |
strrpos |
_chkfloat_ |
_lror_ |
tan517 |
cos517 |
memccpy |
_testbit_ |
_crol_ |
_nop_ |
toascii |
_cror_ |
printf517 |
toint |
exp517 |
scanf517 |
_tolower |
_getkey |
sin517 |
_toupper |
init_mempool |
sprintf517 |
ungetchar |
A

312 |
Appendix A. Differences from ANSI C |
|
|
A