Boost logo

Boost Users :

From: Jens Müller (jens.mueller_at_[hidden])
Date: 2006-05-29 16:28:18


Daniel Mitchell schrieb:

>>Is constructing/passing a struct with no data members more efficient
>>than it is with an enum, or is there no difference?
>
>
> I don't know, but I would bet that the difference--it it exists at all--is
> negligible. Ideally the compiler will elide the struct/enum object
> altogether, since it's only the type that's important.

Yeah, shortly after my post I realized that optimizing away the value is
quite trivially achieved - if the function is inlined, the value is dead
anyway, if it isn't, the compiler might still find out by
interprocedural analysis.

Thanks a lot!


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net