Mistake on this page?
Report an issue in GitHub or email us
Macros
preprocessor macros

Macros

#define MBED_CONCAT(a, b)   MBED_CONCAT_(a, b)
 MBED_CONCAT Concatenate tokens together. More...
 
#define MBED_STRINGIFY(a)   MBED_STRINGIFY_(a)
 MBED_STRINGIFY Converts tokens into strings. More...
 
#define MBED_STRLEN(a)   MBED_STRLEN_(a)
 MBED_STRLEN Reports string token length. More...
 
#define MBED_COUNT_VA_ARGS(...)   GET_NTH_ARG_(__VA_ARGS__, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1)
 MBED_COUNT_VA_ARGS(...) Reports number of tokens passed. More...
 

Detailed Description

Macro Definition Documentation

#define MBED_CONCAT (   a,
 
)    MBED_CONCAT_(a, b)

MBED_CONCAT Concatenate tokens together.

Note
Expands tokens before concatenation
1 // Creates a unique label based on the line number
2 int MBED_CONCAT(UNIQUE_LABEL_, __LINE__) = 1;

Definition at line 39 of file mbed_preprocessor.h.

#define MBED_COUNT_VA_ARGS (   ...)    GET_NTH_ARG_(__VA_ARGS__, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1)

MBED_COUNT_VA_ARGS(...) Reports number of tokens passed.

Note
Token limit is 16
1 // Get number of arguments
2 const int count = MBED_COUNT_VA_ARGS("Address 0x%x, Data[0] = %d Data[1] = %d", 0x20001234, 10, 20)

Definition at line 81 of file mbed_preprocessor.h.

#define MBED_STRINGIFY (   a)    MBED_STRINGIFY_(a)

MBED_STRINGIFY Converts tokens into strings.

Note
Expands tokens before stringification
1 // Creates a string based on the parameters
2 const char *c = MBED_STRINGIFY(This is a ridiculous way to create a string)

Definition at line 53 of file mbed_preprocessor.h.

#define MBED_STRLEN (   a)    MBED_STRLEN_(a)

MBED_STRLEN Reports string token length.

Note
Expands tokens before calculating length
1 // Get string length
2 const int len = MBED_STRLEN("Get the length")

Definition at line 67 of file mbed_preprocessor.h.

Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.