On 2011-04-03 17:25, bearophile wrote: > Jonathan M Davis: > > But there should be no need to worry about whether something is a > > manifest constant or not. > > I'd like in DMD a way to know if something is a compile-time constant. > There is a GCC extension that sometimes is able to do it, named > __builtin_constant_p: > http://www.delorie.com/gnu/docs/gcc/gcc_81.html#IDX629
To what end? Why would you care? It matters whether a value is mutable, const, or immutable, but what does it matter if it was calculated at compile time or not? Unless it's a property, it's definitely going to have been calculated before you use it. The only reason that I see that it matters at the moment is due to bugs in dmd. Once those are fixed, it should be irrelevant. - Jonathan M Davis
