digitalmars.D.learn - Check for ctfe
- cal (4/4) Aug 24 2012 I saw something on the forum not too long ago about statically
- Timon Gehr (2/6) Aug 24 2012 if(__ctfe)
- cal (2/11) Aug 24 2012 Oh i was using it with static if which didn't work, thanks!
- Philippe Sigaud (3/15) Aug 25 2012 Same here. I use it rarely, and every time, I first type 'static if
- Minas Mina (2/2) Aug 25 2012 Why is it "if( __ctfe )" and not
- Philippe Sigaud (4/6) Aug 25 2012 I guess because __ctfe *must* be a runtime value: its value changes at
- Timon Gehr (3/5) Aug 25 2012 Both branches need to be compiled in order to have both a ctfe and a
- bearophile (6/10) Aug 24 2012 It's named __ctfe, but unfortunately it's an (immutable) run-time
- Timon Gehr (2/12) Aug 24 2012 Which is basically guaranteed to be performed.
I saw something on the forum not too long ago about statically checking to see if the current function is being executed at compile time, but can't seem to find it now. Can it be done? (Like static if (__ctfe__) or something)
Aug 24 2012
On 08/25/2012 02:06 AM, cal wrote:I saw something on the forum not too long ago about statically checking to see if the current function is being executed at compile time, but can't seem to find it now. Can it be done? (Like static if (__ctfe__) or something)if(__ctfe)
Aug 24 2012
On Saturday, 25 August 2012 at 00:13:44 UTC, Timon Gehr wrote:On 08/25/2012 02:06 AM, cal wrote:Oh i was using it with static if which didn't work, thanks!I saw something on the forum not too long ago about statically checking to see if the current function is being executed at compile time, but can't seem to find it now. Can it be done? (Like static if (__ctfe__) or something)if(__ctfe)
Aug 24 2012
On Sat, Aug 25, 2012 at 2:20 AM, cal <callumenator gmail.com> wrote:On Saturday, 25 August 2012 at 00:13:44 UTC, Timon Gehr wrote:Same here. I use it rarely, and every time, I first type 'static if (__ctfe) {...'On 08/25/2012 02:06 AM, cal wrote:Oh i was using it with static if which didn't work, thanks!I saw something on the forum not too long ago about statically checking to see if the current function is being executed at compile time, but can't seem to find it now. Can it be done? (Like static if (__ctfe__) or something)if(__ctfe)
Aug 25 2012
Why is it "if( __ctfe )" and not static if.. ?
Aug 25 2012
On Sat, Aug 25, 2012 at 12:53 PM, Minas Mina <minas_mina1990 hotmail.co.uk> wrote:Why is it "if( __ctfe )" and not static if.. ?I guess because __ctfe *must* be a runtime value: its value changes at runtime. And, as 'static if' cannot act on a runtime value...
Aug 25 2012
On 08/25/2012 12:53 PM, Minas Mina wrote:Why is it "if( __ctfe )" and not static if.. ?Both branches need to be compiled in order to have both a ctfe and a runtime version.
Aug 25 2012
cal:I saw something on the forum not too long ago about statically checking to see if the current function is being executed at compile time, but can't seem to find it now. Can it be done? (Like static if (__ctfe__) or something)It's named __ctfe, but unfortunately it's an (immutable) run-time value. When you use it you rely on the dead code elimination optimization done by the compiler. Bye, bearophile
Aug 24 2012
On 08/25/2012 02:15 AM, bearophile wrote:cal:Which is basically guaranteed to be performed.I saw something on the forum not too long ago about statically checking to see if the current function is being executed at compile time, but can't seem to find it now. Can it be done? (Like static if (__ctfe__) or something)It's named __ctfe, but unfortunately it's an (immutable) run-time value. When you use it you rely on the dead code elimination optimization done by the compiler. Bye, bearophile
Aug 24 2012