Name Spaces - mikroElektronika PIC Microcontrollers PIC12 User Manual

Mikroc user's manual
Table of Contents

Advertisement

mikroC - C Compiler for Microchip PIC microcontrollers

NAME SPACES

Name space is the scope within which an identifier must be unique. C uses four
distinct categories of identifiers:
Goto label names
These must be unique within the function in which they are declared.
Structure, union, and enumeration tags
These must be unique within the block in which they are defined. Tags declared
outside of any function must be unique.
Structure and union member names
These must be unique within the structure or union in which they are defined.
There is no restriction on the type or offset of members with the same member
name in different structures.
Variables, typedefs, functions, and enumeration members
These must be unique within the scope in which they are defined. Externally
declared identifiers must be unique among externally declared variables.
Duplicate names are legal for different name spaces regardless of scope rules.
For example:
int blue = 73;
{ // open a block
}
blue = 37;
page
56
enum colors { black, red, green, blue, violet, white } c;
/* enumerator blue hides outer declaration of int blue */
struct colors { int i, j; };
// ILLEGAL: colors duplicate tag
double red = 2;
// ILLEGAL: redefinition of red
// back in int blue scope
MikroElektronika: Development tools - Books - Compilers
mikroC
making it simple...

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the PIC Microcontrollers PIC12 and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Pic microcontrollers pic16Pic microcontrollers pic18

Table of Contents