The ANSI C standard provides each C implementation a method for defining unique
constructs, as required by the architecture of the target processor. This is done using
the #pragma directive. The most common #pragma directive in the MPLAB C18
compiler identifies the section of memory to be used in the PIC18XXXX. For instance,
#pragma code
tells MPLAB 18 to compile the C language code following this directive into the “code”
section of program memory. The code section is defined in the associated linker script
for each PIC18XXXX device, specifying the program memory areas where instructions
can be executed. This directive can be inserted as shown, or it can also be followed by
an address in the code areas of the target processor, allowing full control over the
location of code in memory. Usually, it doesn’t matter, but in some applications, such
as bootloader, it is very important to have strict control over where certain blocks of
code will be executed in the application.
现在不都用XC8了,谁还用C18,感觉XC8用着还行