Re: Inline assembly without inputs considered const/pure?

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

 



On 02/23/2016 09:11 PM, Jeff Epler wrote:
> Since you are already using cc extensions like ({ ... }), you may prefer
> to use __COUNTER__ rather than __LINE__.
> 
> 
> Consider preprocessor input like
>     #define X __LINE__
>     #define Y  X,X,X,X
> 
>     Y;
> 
>     #undef X
>     #define X __COUNTER__
> 
>     Y;
> 
> The first definition of X gives
>     4,4,4,4; // depending on the line that first Y; is on
> and the second one gives
>     0,1,2,3;
> 
> 
> This can be particularly important if mrs() is used multiple times in another
> macro, since when the macro is expanded it is all expanded with the same
> value for __LINE__.

Thank's for the hint. That is indeed alot better than __LINE__. I had
totally forgoten about __COUNTER__.

regards, Matthias
-- 
Matthias Pfaller                          Software Entwicklung
marco Systemanalyse und Entwicklung GmbH  Tel   +49 8131 5161 41
Hans-Böckler-Str. 2, D 85221 Dachau       Fax   +49 8131 5161 66
http://www.marco.de/                      Email leo@xxxxxxxx
Geschäftsführer Martin Reuter             HRB 171775 Amtsgericht München



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux