3 ms·
> What I want to know is what's wrong with __builtin_constant_p. 1. __builtin_constant_p might not return a constant--it might return a magic value that says "
by LukeShu 9y ago
> What I want to know is what's wrong with __builtin_constant_p.
1. __builtin_constant_p might not return a constant--it might return a magic value that says "I don't know yet, ask me again at a later optimization step". __builtin_choose_expr needs to be evaluated pretty early, so "ask again later" isn't good enough for it.
https://lkml.org/lkml/2018/3/18/268 https://lkml.org/lkml/2018/3/18/268
2. It doesn't really care if it is constant in the __builtin_constant_p-sense, it cares if it has side-effects.
> ({x++; 0;}) is constant in the eyes of __builtin_constant_p, but not side-effect free.
https://lkml.org/lkml/2018/3/18/316 https://lkml.org/lkml/2018/3/18/316
- deleted 9y ago[deleted]
- gerdesj 9y agoI'll also drop in another link - https://lkml.org/lkml/2018/3/20/845 https://lkml.org/lkml/2018/3/20/845 that D Wheeler pointed out in LWN and this quote from Mr T's reaction: >That's not "an idea". >That is either genius, or a seriously diseased mind. >I can't quite tell which.