📄 mc.doc
字号:
2.7.3 #define <name> <replacement_text>
The "#define" command allows a global name to be defined,
which will be replaced with the indicated text whenever it is
encountered in the input file. This occurs prior to processing
by the compiler.
2.7.4 #include <filename>
This command causes the indicated file to be opened and read
in as the source text. When the end of the new file is
encountered, processing will continue with the line following
"#include" in the original file.
2.7.5 #ifdef <name>
Processes the following lines (up to #else or #endif) only
if the given name is defined.
2.7.6 #ifndef <name>
Processes the following lines (up to #else or #endif) only
if the given name is NOT defined.
2.7.7 #else
Processes the following lines (up to #endif) only if the
preceeding #ifdef or #ifndef was false.
2.7.8 #endif
Terminates #ifdef and #ifndef
NOTE: The #ifdef and #ifndef contructs may not be nested.
MICRO-C Page: 13
2.8 Error Messages
When MICRO-C detects an error, it outputs an informational
message indicating the type of problem encountered.
The error message is preceeded by the line number(s) of the
line containing the error in all files being processed.
eg: 5:3: Syntax error
In the above example, the main input file "#included" a file at
line 5, and a syntax error was discovered in that file at line 3.
The following error messages are produced by the compiler:
2.8.1 Compilation aborted
The preceeding error was so severe than the compiler cannot
proceed.
2.8.2 Constant expression required
The compiler requires a constant expression which can be
evaluated at compile time (ie: no variables).
2.8.3 Declaration must preceed code.
All local variables must be defined at the beginning of the
function, before any code producing statements are processed.
2.8.4 Dimension table exhausted
The compiler has encountered more active array dimensions
than it can handle.
2.8.5 Duplicate local: 'name'
You have declared the named local symbol more than once
within the same function definition.
2.8.6 Duplicate global: 'name'
You have declared the named global symbol more than once.
2.8.7 Expected '<token>'
The compiler was expecting the given token, but found
something else.
2.8.8 Expression stack overflow
The compiler has found a more complicated expression than it
can handle. Check that it is of correct syntax, and if so,
break it up into two simpler expressions.
MICRO-C Page: 14
2.8.9 Expression stack underflow
The compiler has made an error in parsing the expression.
Check that it is of correct syntax.
2.8.10 Illegal indirection
You have attempted to perform an indirect operation ('*' or
'[]') on an entity which is not a pointer or array. This error
will also result if you attempt to index an array with more
indices than it has dimensions.
2.8.11 Illegal initialization
Local variables may not be initialized in the declaration
statement. Use assignments at the beginning of the function
code to perform the initialization.
2.8.12 Illegal nested function
You may not declare a function within the definition of
another function.
2.8.13 Improper #else/#endif
A #else or #endif statement is out of place.
2.8.14 Inconsistant re-declaration: 'name'
You have attempted to redefine the named external symbol
with a type which does not match its previously declared type.
2.8.15 Incorrect declaration
A statement occuring outside of a function definition is not
a valid declaration for a function or global variable.
2.8.16 Invalid '&' operation
You have attempted to reference the address of something
that has no address. This error also occurs when you attempt to
take the address of an array without giving it a full set of
indicies. Since the address is already returned in this case,
simply drop the '&'. (The error occurs because you are trying
to take the address of an address).
2.8.17 Macro expansion too deep
The compiler has encountered a nested macro reference which
is too deep to be resolved.
2.8.18 Macro space exhausted
The compiler has encountered more macro ("#define") text
than it has room to store.
MICRO-C Page: 15
2.8.19 No active loop
A "continue" or "break" statement was encountered when no
loop is active.
2.8.20 No active switch
A "case" or "default" statement was encountered when no
"switch" statement is active.
2.8.21 Not an argument: 'name'
You have declared the named variable as an argument, but it
does not appear in the argument list.
2.8.22 Non-assignable
You have attempted an operation which results in assignment
of a value to an entity which cannot be assigned. (eg: 1 = 2);
2.8.23 Numeric constant required
The compiler requires a constant expression which returns a
simple numeric value.
2.8.24 String space exhausted
The compiler has encountered more literal strings than it
has room store.
2.8.25 Symbol table full
The compiler has encountered more symbol definitions than it
can handle.
2.8.26 Syntax error
The statement shown does not follow syntax rules and cannot
be parsed.
2.8.27 Too many active cases
The compiler has run out of space for storing switch/case
tables. Reduce the number of active "cases".
2.8.28 Too many defines
The compiler has encountered more '#define' statements than
it can handle. Reduce the number of #defines.
2.8.29 Too many errors
The compiler is aborting because of excessive errors.
MICRO-C Page: 16
2.8.30 Too many includes
The compiler has encountered more nested "#include" files
than it can handle.
2.8.31 Too many initializers
You have specified more initialization values than there are
locations in the global variable.
2.8.32 Type clash
You have attempted to combine values which are of
incompatible types.
2.8.33 Unable to open: 'name'
A "#include" command specified the named file, which could
not be opened.
2.8.34 Undefined: 'name'
You have referenced a name which is not defined as a local
or global symbol.
2.8.35 Unreferenced: 'name'
The named symbol was defined as a local symbol in a
function, but was never used in that function. This error will
occur at the end of the function definition containing the
symbol declaration. It is only a warning, and will not cause
the compile to abort.
2.8.36 Unresolved: 'name'
The named symbol was forward referenced (Such as a GOTO
label), and was never defined. This error will occur at the end
of the function definition containing the reference.
2.8.37 Unterminated conditional
The end of file was encountered when a "#if" or "#else"
conditional block was being processed.
2.8.38 Unterminated function
The end of the file was encountered when a function
definition was still open.
MICRO-C Page: 17
2.9 Quirks
In its effort to provide the maximum amount of functionality
with the minimum amount of code, MICRO-C deviates from standard
'C' in some areas. The following is a short summary of the major
infractions and quirks:
The operands to '#' commands are parsed based on separating
spaces, and any portion of the line not required is ignored. In
particular, the '#define' command only accepts a definition up to
the next space or tab character.
eg: #define APLUSONE A+1 <-- uses "A+1"
#define APLUSONE A +1 <-- uses "A"
Comments are stripped by the token scanner, which occurs AFTER
the '#' commands are processed.
eg: #define NULL /* comment */ <-- uses "/*"
Note that since comments can therefore be included in "#define"
symbols, you can use "/**/" to simulate spaces between tokens.
eg: #define BYTE unsigned/**/char
Include filenames are not delimited by '""' or '<>' and are
passed to the operating system exactly as entered.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -