__has_side_effects

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Fri Mar 30 20:28:27 UTC 2018


https://www.reddit.com/r/programming/comments/88aqsf/the_joy_of_max/

Discussion aside, I notice with pleasant surprise gcc has an 
introspection primitive we didn't think of: __is_constant that (I 
assume) yields true if the given expression has no side effects.

In D the primitive would be called e.g. __has_side_effects to avoid 
confusion with the "const" qualifier.

I wonder how difficult it would be to define __has_side_effects (it 
would apply to an alias) and how it can be put to good use.


Andrei


More information about the Digitalmars-d mailing list