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

From: <sylvain.bertrand_AT_gmail.com>
Date: Fri, 13 Oct 2017 10:29:41 +0000

Hi,

I would go #define and not direct "static const".

Because I think "const" is part of the excess syntax of C and should be
optional (and treated as an optional variable attribute).

Then I would add simple macros than would, based on the compiler, enable the
attribute or not. It's a bit what's done with gcc attributes already. Even
though a compiler can ignore the const attribute to generate code.

The pb are devs which are hardcoding gcc attributes in their code to make an
hard dep on gcc (ported some gnu/linux code from _gcc only_ to at least tinycc,
I think kmod and/or libblkid).
But I digress from the topic.

-- 
Sylvain
Received on Fri Oct 13 2017 - 12:29:41 CEST

This archive was generated by hypermail 2.3.0 : Fri Oct 13 2017 - 12:36:22 CEST