Why exe size change if import entire std or just writeln?

Salih Dincer salihdb at hotmail.com
Fri Mar 25 01:26:58 UTC 2022


On Thursday, 24 March 2022 at 01:49:30 UTC, Marcone wrote:
>
> If dependencies are resolved at compile time, why does the 
> compiler include extra stuff?

You are right! Test results on linux:

```d
//import std.stdio : writefln;/*
version = 1;
import core.stdc.stdio : printf;//*/


void main()
{
   string hello = "hello";

   version(1)
   {
     printf("%s world\n", hello.ptr);// 6464 bytes with strip
   }

   else hello.writefln!"%s World!";  // 196KB with strip
}
/*
  * ldc2 -O hello.d -release
  */

```



More information about the Digitalmars-d-learn mailing list