maria-developers team mailing list archive
-
maria-developers team
-
Mailing list archive
-
Message #04394
Re: Compiler warning about assigned but not used variables fixed
Hi, Vladislav!
On Oct 18, Vladislav Vaintroub wrote:
> > -----Original Message-----
> > From: maria-developers-
> > bounces+wlad=montyprogram.com@xxxxxxxxxxxxxxxxxxx [mailto:maria-
> > developers-bounces+wlad=montyprogram.com@xxxxxxxxxxxxxxxxxxx] On
> > Behalf Of Sergei Golubchik
> > Sent: Dienstag, 18. Oktober 2011 10:15
> > To: maria-developers@xxxxxxxxxxxxxxxxxxx
> > Subject: Re: [Maria-developers] Compiler warning about assigned but not
> > used variables fixed
>
> > try not to overuse #ifdef's, (*)
> > prefer __attribute__((unused)) instead.
>
> > it is less error-prone and results in a more maintainable and readable
> > code.
>
> This really depends on what you're used:) With anything but gcc,
> __attribute__((unused)) is a lengthy zero-effect macro. I did not find
> double-underscore macros really readable, but it must be just me.
That's not what I meant :)
They aren't exactly readable, but one can ignore them when reading the
code. As for the ifdef, there are two readability issues:
1. It interrupts the normal code flow by using constructs with a zero
indentation.
function
if
loop
another if
whatever
whoops. full stop. matrix reloaded.
continue at where we've stopped.
tell your brain to load the saved context.
2. when reading ifdefs one needs to consider the ifdef condition, and
keep it in mind, matching different code lines to each other
. o O (hmm.. ifdef'ed block. will it be enabled together with the
ifdef'ed definition two screens above? Or was it a different ifdef
condition?.. Oh, that one is a subset of this one. Damn!..)
Regards,
Sergei
References