Re: [dev] [general][discussion] constants: `#define` or `static const`

From: Laslo Hunhold <>
Date: Thu, 12 Oct 2017 22:11:22 +0200

On Thu, 12 Oct 2017 15:21:14 +0100
Matthew Parnell <> wrote:

Hey Matthew,

> Afternoon suckless community.
> It is made clear in the suckless coding style guide when to use
> #define and enums; however, it doesn't mention general global
> constants.

as a general rule of thumb I think it's valid to try to reduce the
usage of the CPP as much as possible. It's a powerful tool, but for
defines like this, something might get lost.
After all, if you compile your code with debug flags, you won't be able
to trace back the constant "FOO", it will just be a literal to the
debugger. Using it as a "static const" variable, the debugger will be
able to "see" it, providing more context.
Apart from that though, in my opinion, such defines are a misuse of the
CPP in most cases.

With best regards

Laslo Hunhold

Laslo Hunhold <>
Received on Thu Oct 12 2017 - 22:11:22 CEST

This archive was generated by hypermail 2.3.0 : Thu Oct 12 2017 - 22:24:06 CEST