Skip to content

policies/coding-style.md: move "defined" to other function-like things #114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions policies/coding-style.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,13 @@ a function or keyword. Use a space after most keywords:
if, switch, case, for, do, while, return
```

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

For `sizeof`, use a variable when at all possible, to ensure that type changes
are properly reflected:

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

```c
& * + - ~ ! defined
& * + - ~ !
```

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