Member function increases size of a struct defined in a function - is this a bug?

Max Samukha maxsamukha at gmail.com
Tue Feb 11 11:32:47 UTC 2020


On Friday, 7 February 2020 at 22:41:25 UTC, Steven Schveighoffer 
wrote:

> However, it might need to know that before compiling.
>
> It could really be based on how the compilation is implemented, 
> making it difficult to figure this out.
>
> The "add a closure reference if there are any functions" seems 
> like a really easy thing to just do and not worry about it. And 
> honestly, just putting static in front of the struct is also 
> easy.
>
> -Steve

Sorry for the late reply. I agree it is not a big issue. On the 
other hand, to draw an (probably far-fetched) analogy with C++ 
structs, I would be surprised if the compiler added a vtable 
pointer to the struct in the absence of virtual functions.


More information about the Digitalmars-d mailing list