Cx51 User's GuideCx51 Introduction Compiling Programs Language Extensions Preprocessor Advanced Programming 8051 Derivatives Error Messages Library Reference Appendix A. ANSI C Implementation Implementation-defined Behavior Compiler-Related Library-Related B. Version Differences Version 6.0 Differences Version 5.0 Differences Version 4.0 Differences Version 3.4 Differences Version 3.2 Differences Version 3.0 Differences Version 2.0 Differences C. Writing Optimum Code Memory Model Variable Location Variable Size Unsigned Types Local Variables Other Sources D. Compiler Limits E. Byte Ordering F. Hints, Tips, and Techniques Recursive Code References Problems Using printf Uncalled Functions Using Monitor-51 Trouble with bdata Function Pointers
The following section describes the implementation-defined behavior of the Cx51 Compiler.
CPU Startup and Main Function
At reset the CPU starts executing the startup and initialization code that is explained in Advanced Programming - Customization Files. The C function called by this startup code must be defined with void main (void) or int main (void). No arguments or parameters are passed to this main function and a return from main will cause undefined behavior. Therefore the main function must never return.
Source Code and Identifiers
The source character set is the standard ASCII character set. There is no mapping of ASCII characters which indicates that the target uses also standard ANSI character set. Multibyte characters and locale are not supported.
Refer to Appendix D. Compiler Limits for significant characters in identifiers and other compiler limitations.
The available variable types are explained under Advanced Programming - Data Storage Format and values are stored in big endian format. A plain char is treated as signed char.
Converting an int or long value to a shorter value is made by truncation. Any value that is assigned to the data type bit is tested against 0; values that are not 0 result in 1 when assigned to a bit value. When an integer number is cast to a float value, the value is rounded down.
A struct bitfield is always treated as unsigned integer value. Only char, unsigned char, int, and unsigned int are supported as storage unit for bitfields. Bitfields are allocated within the storage unit from the least-significant to the most-significant bit and a bitfield cannot straddle across a storage unit boundaries.
of your data.