Inline assembly without inputs considered const/pure?

Matthias Pfaller leo@marco.de
Wed Feb 24 06:28:00 GMT 2016


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@marco.de
Geschäftsführer Martin Reuter             HRB 171775 Amtsgericht München



More information about the Gcc-help mailing list