pragma attribute syntax

Artur Skawina art.08.09 at
Wed Jun 6 08:29:46 PDT 2012

On 06/06/12 17:03, Artur Skawina wrote:
> I know. What I'm saying is that omitting the "noinline" attribute causes
> the "pure" function, like s.f() above, to be called twice. Add the
> "noinline" back, with no other changes - and it gets called only once.

What i mean by "called" in this case is of course that the code runs
twice when inlined. I was testing with impure bodies, did another test
right now, and it seems that it may only happen in that case. But it's
hard to tell, as the compiler manages to optimize the really pure inlined
parts well. It's just surprising that program behavior changes depending
on the availability of function bodies. If this only happens for "illegal"
code it's of course not a problem. It does mean that things like debug
output change based on inlining decisions though.


More information about the D.gnu mailing list