Re: CTFE in betterC needs the GC

2022-10-29 Thread Ali Çehreli via Digitalmars-d-learn
On 10/29/22 20:41, arandomonlooker wrote: > string exampleCTFE(string a, string b) { > return a ~ b; > } Although you need that function only at compile time, it is an ordinary function that could be called at run time as well. The function needs GC for that concatenation in the general

CTFE in betterC needs the GC

2022-10-29 Thread arandomonlooker via Digitalmars-d-learn
Hello, i'm a beginner to the D programming language that has posted many times for simple questions and code errors. I have written a function that manipulates D code (passed through a q{...} block) and returns it to be compiled into the program by a mixin. The problem is that i need to do so

Re: CTFE in betterC needs the GC

2022-10-29 Thread arandomonlooker via Digitalmars-d-learn
On Sunday, 30 October 2022 at 04:14:17 UTC, Ali Çehreli wrote: On 10/29/22 20:41, arandomonlooker wrote: > [...] Although you need that function only at compile time, it is an ordinary function that could be called at run time as well. The function needs GC for that concatenation in the

Re: how to benchmark pure functions?

2022-10-29 Thread max haughton via Digitalmars-d-learn
On Thursday, 27 October 2022 at 18:41:36 UTC, Dennis wrote: On Thursday, 27 October 2022 at 17:17:01 UTC, ab wrote: How can I prevent the compiler from removing the code I want to measure? With many C compilers, you can use volatile assembly blocks for that. With LDC -O3, a regular assembly