Fix: optional.h macro missing parentheses and guards
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 18 Dec 2019 15:50:00 +0000 (10:50 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 19 Dec 2019 22:06:12 +0000 (17:06 -0500)
commitbc2dc8d464c34ad5a51ed46e46c6fc98a5bbf3fd
tree63ce4678d6fbe003faf52ac344ea015abba48952
parenta1298db6cf0b806e968d9baa6da08ab78caf460b
Fix: optional.h macro missing parentheses and guards

The are a few coding style issues with optional.h which leads to
unexpected effects when the macros are used in the caller code.

All macro parameters need to be surrounded by () (except when used near
commas, which is the C operator with least precedence).

All macros that emit code need to be surrounded by do { } while (0) so
not to emit extra ; or omit ;, which can cause subtle issues when used
with if/else statements.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Iba6fde7c267f4d8c9ec1a89147045f0bcda3a67a
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/common/optional.h
This page took 0.025284 seconds and 4 git commands to generate.