On 12:19 Fri 06 May , Arnaud Lacombe wrote:Why would it be a good thing ?sorry but conditionnal structure members is bad practice
Most configuration-dependent code inside functions tends to be moved
to a static inline already, which get conditionally defined based on
the CONFIG_<foo>. If it is not, then the code is badly architectured
(-> bad). Using that if(xxx) notation would also lead to yet more
heavily indented function (-> bad). Moreover, this introduces
yet-another way to check for an information (-> bad), and you will end
up with mixing the config_is_<xxx> notation inside a function
declaration, and CONFIG_<xxx> when not inside a function (-> bad)
Actually, this is even worse than that as you'll not be able to hide
structure (or structure members) inside CONFIG_<xxx> and use that
structure (or structure members) in config_is_<xxx> protected block
without causing compile-time failure.
you save nearly no space nut for the test of the code in multiple
configuration. Use union for this.
the compile-time failure is good here. it's means your code is not generic.
specially when you want to keep code running on multiple soc/arch keep compiling
no matter the configuration
#ifdef in the code is a really bad habit