Skip to content

Instantly share code, notes, and snippets.

@fredemmott
Created December 17, 2020 18:06
Show Gist options
  • Select an option

  • Save fredemmott/ef829d6a27f48b310a392e5b8e162cb2 to your computer and use it in GitHub Desktop.

Select an option

Save fredemmott/ef829d6a27f48b310a392e5b8e162cb2 to your computer and use it in GitHub Desktop.
Why you want to run `cl.exe /vmg`
$ cl.exe test.cpp && test.exe
10 4
$ g++ test.cpp -o test && ./test
10 10
$ cl.exe /vmg test.cpp && test.exe
10 10
#include <cstdio>
class ForwardDeclared;
class Defined {
void foo();
};
struct ContainerA {
void (ForwardDeclared::*ptr)();
};
struct ContainerB {
void (Defined::*ptr)();
};
int main() {
printf("%lx %lx\n", sizeof(ContainerA), sizeof(ContainerB));
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment