Skip to content

Commit 6806d41

Browse files
esyrlevitte
andcommitted
policies/coding-style.md: move "defined" to other function-like things
While "defined" is indeed a unary preprocessor operator, it is treated as a function sintactically in the codebase, similar to sizeof and friends. Co-Authored-by: Richard Levitte <[email protected]> Signed-off-by: Eugene Syromiatnikov <[email protected]>
1 parent e543ab3 commit 6806d41

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

policies/coding-style.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -167,11 +167,13 @@ a function or keyword. Use a space after most keywords:
167167
if, switch, case, for, do, while, return
168168
```
169169

170-
Do not use a space after `sizeof`, `typeof`, `alignof`, or `__attribute__`.
171-
They look somewhat like functions and should have parentheses
172-
in OpenSSL, although they are not required by the language. For `sizeof`,
173-
use a variable when at all possible, to ensure that type changes are
174-
properly reflected:
170+
Do not use a space after the preprocessor keyword `defined`,
171+
or the C language keywords `sizeof`, `typeof`, `alignof`, or `__attribute__`.
172+
They look somewhat like functions and should have parentheses in OpenSSL,
173+
although they are not required by the language.
174+
175+
For `sizeof`, use a variable when at all possible, to ensure that type changes
176+
are properly reflected:
175177

176178
```c
177179
SOMETYPE *p = OPENSSL_malloc(sizeof(*p) * num_of_elements);
@@ -206,7 +208,7 @@ and after semicolons in `for` statements, but not in `for (;;)`.
206208
Do not put a space after unary operators:
207209

208210
```c
209-
& * + - ~ ! defined
211+
& * + - ~ !
210212
```
211213

212214
Do not put a space before the postfix increment and decrement unary

0 commit comments

Comments
 (0)