Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MSVC Compiler Error C4315 - No Documentation Found

When compiling my app today, I encountered this warning (the code, I think, is irrelevant):

warning C4315: 'MyClass' : 'this' pointer for member 'MyClass::my_data_' may not be aligned 8 as expected by the constructor

I am not able to find any documentation about this warning, in either the online help, my locally-installed help, or via a google search. I did find one link on a MS forum:

No documentation for compiler warning C4315

But no information about the error itself.

Do you have any information about this error? I'm trying to fogure out how to fix it.

like image 680
John Dibling Avatar asked Nov 19 '10 18:11

John Dibling


1 Answers

I'd look for something (buried in a header?) changing the structure packing from the default.

The warning seems to be saying that whatever type MyClass::my_data_ is expects to be 8-byte aligned, but it's not being placed at that alignment inside MyClass.

Search for #pragma pack(some-number) directives that aren't reset with a #pragma pack().

Using #pragma pack(show) would probably be helpful, too.

like image 51
Michael Burr Avatar answered Nov 05 '22 22:11

Michael Burr