lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] Forcing linking of the library modules (again)


From: Greg Chicares
Subject: Re: [lmi] Forcing linking of the library modules (again)
Date: Sat, 04 Oct 2014 17:22:37 +0000
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:24.0) Gecko/20100101 Thunderbird/24.6.0

On 2014-10-04 14:52Z, Vadim Zeitlin wrote:
[...snip illuminating stuff that I'm still thinking about...]
> 
>  But I'd like to notice that there is a small problem with the new
> LMI_FORCE_LINKING_{IN,EX}_SITU() macros: they are inconsistent in their
> handling of the subsequent semicolon as the former requires it, while the
> latter does not.

Speaking of which...

> not terminating the macro definition with a semicolon
> is the common rule

...I agree that this is the right rule in this case. But I happened
to inspect the function-like macro LMI_ASSERT(), which, conversely,
I do prefer to terminate with a semicolon...and realized that, on
line 57 here:
  
http://svn.savannah.nongnu.org/viewvc/lmi/trunk/assert_lmi.hpp?annotate=5853&root=lmi
a novel anti-rule is applied: just append the magic line
  do {} while(0)
to any macro, and...umm...the sorcerer's apprentice has no clothes,
to coin a phrase.

A more effective technique is of course to be found here:
  https://gcc.gnu.org/onlinedocs/cpp/Swallowing-the-Semicolon.html
and I'll make appropriate modifications soon. If my modifications
don't cure the problem, I will trust your eagle eye to point it out.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]