How to use ".stringof" to get the value of a variable and not the name of the variable (identifier) itself?

rempas rempas at tutanota.com
Mon Oct 9 18:28:04 UTC 2023


On Monday, 9 October 2023 at 17:52:58 UTC, Jonathan M Davis wrote:
>
> The closest to a built-in solution would be toString on classes 
> and structs, but structs don't necessarily have a toString. 
> Rather, in many cases, Phobos does introspection on the struct 
> to figure out how to convert the struct's members to a string 
> if no toString is present (which isn't necessarily pretty but 
> generally works well for debug output). Anyone looking to be 
> able to do that sort of thing without Phobos is either going to 
> need to reimplement what Phobos does themselves or use a third 
> party library that already does that.
>
> [...]

Thank you for the info. Unfortunately, while my project uses 
libc, I try to get rid of it as well, so it will also not do. I 
may create a function in the future myself. Thanks a lot for your 
time and I hope you have a beautiful day!


More information about the Digitalmars-d-learn mailing list