On Tuesday, 18 December 2018 at 14:23:38 UTC, berni wrote:
On Tuesday, 18 December 2018 at 13:53:01 UTC, Stefan Koch wrote:
Why would you need to know?
Well, first out of curiosity. But there are also other reasons:
I've got a large immutable array. Without CTFE I'd use some php
script and
On Tuesday, December 18, 2018 9:20:11 AM MST berni via Digitalmars-d-learn
wrote:
> On Tuesday, 18 December 2018 at 14:32:29 UTC, Adam D. Ruppe wrote:
> > CTFE is used if and only if it MUST be used by context. That's
> > a runtime function, so no ctfe.
> >
> > Do something like:
> >
> > int[4]
On Tuesday, 18 December 2018 at 14:32:29 UTC, Adam D. Ruppe wrote:
CTFE is used if and only if it MUST be used by context. That's
a runtime function, so no ctfe.
Do something like:
int[4] generate() {
int[4] tmp;
foreach(i; 0..4) tmp[i] = i;
return tmp;
}
static immutable int[4]
On Tuesday, 18 December 2018 at 14:23:38 UTC, berni wrote:
import std.stdio;
class A
{
static immutable int[4] clue;
static this()
{
if(__ctfe) assert(0, "Yep, CTFE used");
foreach (i;0..4) clue[i] = i;
}
}
CTFE is used if and only if it MUST be used by
On Tuesday, 18 December 2018 at 13:53:01 UTC, Stefan Koch wrote:
Why would you need to know?
Well, first out of curiosity. But there are also other reasons:
I've got a large immutable array. Without CTFE I'd use some php
script and add it as a large literal. With CTFE I don't need that
php
On 12/18/18 7:21 AM, berni wrote:
Is there a way to check if a function is indeed executed at compile time
or not? (Other than going through the whole executable binaries...)
I tried
static this()
{
if (__ctfe) pragma(msg,"works");
// some other stuff
}
but unfortunatley this "if" is
On Tuesday, 18 December 2018 at 12:21:44 UTC, berni wrote:
Is there a way to check if a function is indeed executed at
compile time or not? (Other than going through the whole
executable binaries...)
I tried
static this()
{
if (__ctfe) pragma(msg,"works");
// some other stuff
}
but
On Tue, Dec 18, 2018 at 1:25 PM berni via Digitalmars-d-learn <
digitalmars-d-learn@puremagic.com> wrote:
> Is there a way to check if a function is indeed executed at
> compile time or not? (Other than going through the whole
> executable binaries...)
>
> I tried
>
> > static this()
> > {
> >
Is there a way to check if a function is indeed executed at
compile time or not? (Other than going through the whole
executable binaries...)
I tried
static this()
{
if (__ctfe) pragma(msg,"works");
// some other stuff
}
but unfortunatley this "if" is also executed at compile time,