On Wednesday, 20 December 2017 at 13:57:20 UTC, Mike Parker wrote:
The blog

it won’t catch every error; for example, structs, classes and other user defined types are mangled > by name only, so that a change to their definition will still pass unnoticed by the linker.

Wouldn't it be possible to append the hash of the struct's type definition to make the changes to the struct's definition noticeable during linking?


module test;

struct S
    int x;
    float y;

void foo ( S s ) { }

You might create a hash this way:

hash = Fnv1a(mangle(Tint32), mangle(Tfloat32));

And then foo's name mangle changes from:


It may not be 100% fool-proof yet though, because we'd also have to hash a bunch of other things like align() attributes.

Or is this is overkill?

Reply via email to