| Electronic Components Datasheet Search |
|
AN3350 Datasheet(PDF) 124 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
AN3350 Datasheet(HTML) 124 Page - STMicroelectronics |
|
124 / 185 page ![]() Using pragmas AN3350 124/185 Doc ID 018512 Rev 2 16 Using pragmas The #pragma preprocessor directive specifies option settings to the compiler to control the compiler and linker’s code generation. ● Checking pragma settings ● Saving and restoring pragma settings ● Determining which settings are saved and restored ● Invalid pragmas 16.1 Checking pragma settings The preprocessor function __option() returns the state of pragma settings at compile- time. The syntax is __option(setting-name) where setting-name is the name of a pragma that accepts the on, off, and reset arguments. If setting-name is on, __option(setting-name) returns 1. If setting-name is off, __option(setting-name) returns 0. If setting-name is not the name of a pragma, __option(setting-name) returns false. If setting-name is the name of a pragma that does not accept the on, off, and reset arguments, the compiler issues a warning message. Example 74 shows an example. Example 74 Using the __option() preprocessor function #if __option(ANSI_strict) #include "portable.h" /* Use the portable declarations. */ #else #include "custom.h" /* Use the specialized declarations. */ #endif 16.2 Saving and restoring pragma settings There are some occasions when you would like to apply pragma settings to a piece of source code independently from the settings in the rest of the source file. For example, a function might require unique optimization settings that should not be used in the rest of the function’s source file. Remembering which pragmas to save and restore is tedious and error-prone. Fortunately, the compiler has mechanisms that save and restore pragma settings at compile time. Pragma settings may be saved and restored at two levels: ● All pragma settings ● Some individual pragma settings Settings may be saved at one point in a compilation unit (a source code file and the files that it includes), changed, then restored later in the same compilation unit. Pragma settings |
|
Link URL |
| Does ALLDATASHEET help your business so far? [ DONATE ] |
About Alldatasheet | Advertisement | Contact us | Privacy Policy | Link to Datasheet | Link Exchange | Manufacturer List All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |