CTFE with C functions not possible?

Shriramana Sharma via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jan 1 18:35:47 PST 2016


Rikki Cattermole wrote:

> How exactly is a D version more bulky then C?
> After all everything C can do, D can do with a very similar syntax.

Source-code wise D is much leaner than C, obviously, but object-code wise it 
is *huge* even with dynamically linking Phobos:

The binary size of compiling my C version is 20271 and that of the D version 
with exact same functionality is 1031061. 

I thought maybe it's because I'm using a few ctRegex-es and that's getting 
included into the source code, but using ordinary regex actually increases 
the size to 1112343.

I suppose 1 MB is not a big deal these days, and if I cared about quick 
programming and not worry about buffer overflows, I have to sacrifice 
*something*, but still comparing to C, I can't help but feel that most of 
that 1 MB is functionality that the program never uses but I'm not expert 
enough to find out. If DMD had something like -fdata-sections -ffunction-
sections, passing --gc-sections might be able to slim that down, I dunno...

-- 
Shriramana Sharma, Penguin #395953


More information about the Digitalmars-d-learn mailing list