Update c.html.markdown

Note on macro hygiene. Fixes #2853
This commit is contained in:
Adam Bard 2017-09-12 22:42:18 -07:00 committed by GitHub
parent a6e460618d
commit a5c23e8af4

View File

@ -756,8 +756,14 @@ as the C file.
/* Like c source files macros can be defined in headers and used in files */
/* that include this header file. */
#define EXAMPLE_NAME "Dennis Ritchie"
/* Function macros can also be defined. */
#define ADD(a, b) (a + b)
#define ADD(a, b) ((a) + (b))
/* Notice the parenthesis surrounding the arguments -- this is important to */
/* ensure that a and b don't get expanded in an unexpected way (e.g. consider */
/* MUL(x, y) (x * y); MUL(1 + 2, 3) would expand to (1 + 2 * 3), yielding an */
/* incorrect result) */
/* Structs and typedefs can be used for consistency between files. */
typedef struct Node