sites

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit ca2054920547c502bd77ccc77a585a99bc04cf02
parent 6c1a7649e26079337aff8d33330f893a4a4a6ff3
Author: sin <sin@2f30.org>
Date:   Tue, 23 Dec 2014 11:24:51 +0000

style: Add info about enums + #defines

Diffstat:
Msuckless.org/style.md | 13+++++++++++++
1 file changed, 13 insertions(+), 0 deletions(-)

diff --git a/suckless.org/style.md b/suckless.org/style.md @@ -146,3 +146,16 @@ Handling Errors * `return` or `exit` early on failures instead of multiple nested levels * Unreachable code should have a NOTREACHED comment * Think long and hard on whether or not you should cleanup on fatal errors + +Enums vs #define +---------------- +* Use enums for values that are grouped semantically and #define otherwise. + + #define MAXSZ 4096 + #define MAGIC1 0xdeadbeef + + enum { + DIRECTION_X, + DIRECTION_Y, + DIRECTION_Z + };