Re: Aliasing a mixin (or alternative ways to profile a scope)

2019-03-08 Thread Simon via Digitalmars-d-learn

On Thursday, 7 March 2019 at 21:50:17 UTC, Johannes Loher wrote:

enum profile_scope(string name) = "import core.stdc.stdio : 

~ name ~ "\n\"); scope(exit) printf(\"" ~ name ~ "\n\");";

extern (C) void main()

This uses string concatenation only at compile time and not 
during run
time, so it does not require the garbage collector and is 

with betterC :)

Thanks, this works flawlessly. Out of interest: what is the 
"enum" doing there? I had the exact same behaviour in a function 
before, that I only called at compile-time, so why did it 
complain then? Can I somehow tell the compiler that a function 
should only be available at compile-time?

Phobos in BetterC

2019-03-08 Thread Vasyl Teliman via Digitalmars-d-learn
I've tried to use Mallocator in BetterC but it seems it's not 
available there:

This produces a linker error.

I'm wondering why Mallocator is not available in this mode (it 
would be intuitive to assume that it's working). Also I would 
like to know what parts of Phobos are available there (e.g. 
std.traits, std.typecons...).

Thanks in advance.