Thread overview
D compiler equivilent of "gcc -E" for debug/view template instantiation(generated) code?
Jul 30, 2021
dangbinghoo
Jul 30, 2021
WebFreak001
Jul 30, 2021
dangbinghoo
Jul 30, 2021
dangbinghoo
Jul 30, 2021
Mike Parker
Jul 30, 2021
dangbinghoo
Jul 30, 2021
Stefan Koch
Jul 31, 2021
dangbinghoo
July 30, 2021

hi, is there any D compiler option or other method to view the final template instantiation but not compiled (in asm or binary) code?

if there's a way, it might be very usefull for newbies like me to learn and understand the the Meta programming of dlang.

thanks!

dbh

July 30, 2021

On Friday, 30 July 2021 at 06:00:41 UTC, dangbinghoo wrote:

>

hi, is there any D compiler option or other method to view the final template instantiation but not compiled (in asm or binary) code?

if there's a way, it might be very usefull for newbies like me to learn and understand the the Meta programming of dlang.

thanks!

dbh

Not sure if this is exactly what you want but there is a hidden switch in dmd called -vcg-ast that prints out all the templates instantiated.

On run.dlang.io you can use the "AST" button to view this conveniently online.

July 30, 2021

On Friday, 30 July 2021 at 06:46:18 UTC, WebFreak001 wrote:

>

On Friday, 30 July 2021 at 06:00:41 UTC, dangbinghoo wrote:

Not sure if this is exactly what you want but there is a hidden switch in dmd called -vcg-ast that prints out all the templates instantiated.

On run.dlang.io you can use the "AST" button to view this conveniently online.

thanks a lot! this is truelly what I exactly want! it's great!

July 30, 2021

On Friday, 30 July 2021 at 06:46:18 UTC, WebFreak001 wrote:

>

On Friday, 30 July 2021 at 06:00:41 UTC, dangbinghoo wrote:

>

Not sure if this is exactly what you want but there is a hidden switch in dmd called -vcg-ast that prints out all the templates instantiated.

but, where's these switch option documented? it seems it not appears in dmd --help or man dmd, or online document https://dlang.org/dmd-linux.html

thanks!

dbh.

July 30, 2021

On Friday, 30 July 2021 at 08:38:24 UTC, dangbinghoo wrote:

>

but, where's these switch option documented? it seems it not appears in dmd --help or man dmd, or online document https://dlang.org/dmd-linux.html

That's what he meant by "hidden" switch. I don't know why it isn't documented, but it probably should be.

July 30, 2021

On Friday, 30 July 2021 at 09:30:13 UTC, Mike Parker wrote:

>

On Friday, 30 July 2021 at 08:38:24 UTC, dangbinghoo wrote:

>

but, where's these switch option documented? it seems it not appears in dmd --help or man dmd, or online document https://dlang.org/dmd-linux.html

That's what he meant by "hidden" switch. I don't know why it isn't documented, but it probably should be.

sorry, I just not noticed "hidden", thanks for all of you!

July 30, 2021

On Friday, 30 July 2021 at 09:30:13 UTC, Mike Parker wrote:

>

On Friday, 30 July 2021 at 08:38:24 UTC, dangbinghoo wrote:

>

but, where's these switch option documented? it seems it not appears in dmd --help or man dmd, or online document https://dlang.org/dmd-linux.html

That's what he meant by "hidden" switch. I don't know why it isn't documented, but it probably should be.

The reason why it's not documented is because we don't want people to rely on the format of the output.
I guess if we put that disclaimer in the docs we could ...

July 31, 2021

On Friday, 30 July 2021 at 10:20:36 UTC, Stefan Koch wrote:

>

On Friday, 30 July 2021 at 09:30:13 UTC, Mike Parker wrote:

>

On Friday, 30 July 2021 at 08:38:24 UTC, dangbinghoo wrote:

>

but, where's these switch option documented? it seems it not appears in dmd --help or man dmd, or online document https://dlang.org/dmd-linux.html

That's what he meant by "hidden" switch. I don't know why it isn't documented, but it probably should be.

The reason why it's not documented is because we don't want people to rely on the format of the output.
I guess if we put that disclaimer in the docs we could ...

ok, that is reasonable. thanks!