diff options
Diffstat (limited to 'Documentation/CodingStyle')
| -rw-r--r-- | Documentation/CodingStyle | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle index 449a8a19fc21..4d4f06d47e06 100644 --- a/Documentation/CodingStyle +++ b/Documentation/CodingStyle | |||
| @@ -659,6 +659,19 @@ macros using parameters. | |||
| 659 | #define CONSTANT 0x4000 | 659 | #define CONSTANT 0x4000 |
| 660 | #define CONSTEXP (CONSTANT | 3) | 660 | #define CONSTEXP (CONSTANT | 3) |
| 661 | 661 | ||
| 662 | 5) namespace collisions when defining local variables in macros resembling | ||
| 663 | functions: | ||
| 664 | |||
| 665 | #define FOO(x) \ | ||
| 666 | ({ \ | ||
| 667 | typeof(x) ret; \ | ||
| 668 | ret = calc_ret(x); \ | ||
| 669 | (ret); \ | ||
| 670 | )} | ||
| 671 | |||
| 672 | ret is a common name for a local variable - __foo_ret is less likely | ||
| 673 | to collide with an existing variable. | ||
| 674 | |||
| 662 | The cpp manual deals with macros exhaustively. The gcc internals manual also | 675 | The cpp manual deals with macros exhaustively. The gcc internals manual also |
| 663 | covers RTL which is used frequently with assembly language in the kernel. | 676 | covers RTL which is used frequently with assembly language in the kernel. |
| 664 | 677 | ||
