-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Visual Studio can't compile aligned function parameters #82
Comments
Sorry, forgot to mention that this is with v1.5.0 |
…ence. This is mostly to fix compilation with Visual Studio that can't process the requested alignment for function parameters. See: HandmadeMath#82
…ence. (HandmadeMath#82) This is mostly to fix compilation with Visual Studio that can't process the requested alignment for function parameters. See: HandmadeMath#82
This is mostly to fix compilation with Visual Studio that can't process the requested alignment for function parameters. See: HandmadeMath#82
Enable |
Hey, ill look into getting this fixed. @coastwise I see all your commits passing everything as const ref's instead due to us having to keep C compatibility we can't do that. If i remember correctly this only happens when you compile in MSVC using a x86 configuration ? |
Thanks! That is the configuration I'm using yes. I'm calling cl directly. I guess I saw the operator overloads and didn't realize they were in a #ifdef __cplusplus block. I obviously won't make a pull request with it, but the const refs have unblocked me from developing on windows for now. Cheers, |
If you compiled with x64 it wouldn't be an issue, but i understand that isn't the real solution here |
@coastwise Hey spent some time tonight trying to reproduce this in Visual Studio 2017, and i couldn't. Can you provide me a with repro file? |
Hey, I've added a build script and minimum source file to reproduce the errors I'm having. Try running visualstudio_build.bat in the tests folder https://github.com/coastwise/Handmade-Math/tree/visualstudio |
Thanks! |
Weird seems that i can't reproduce this on VS2017. All i did was is change the VcVarsall path in the bat file you supplied fork you supplied. Ill check later if one of my other PCs has a earlier version of VS installed |
I can repro on VS2015 community: If I compile the tests/hmm_test.c (and add HandemadeMath.c), and use a "win32" target (32 bit), I get this error. If I create a x64 target and compile I do not see this error. I think this should either be documented, a more clear static assertion should be thrown, or the ifdefs should automatically do whatever they need to do to fix this. |
Ohhhhhhh, i never use x86 mode this could actually be a problem! Let me see if i can reproduce ill get back to you ASAP |
So an update on the investigation. I compiled HandmadeMath.h in x86 mode with C and CPP and got no errors. This might be caused be a default Visual Studio parameter.
|
If you just include the On the plus side, I do not see this repro in VS 2017 in x86 mode. I only see the problem on VS 2015. I tried with cl.exe, roughly as you described, with test suite instead, and here's the output - VS 2015:
VS 2017:
With the VS 2017 compile, I also get 100% of tests passing when I run |
Seems ill have to get VS2015 installed and get back to you. I LOVE when compiler updates change things haha. |
When compiling using Visual Studio 2017 I get the following errors:
These function parameters could be const references instead of copies as this SO post suggests, no?
https://stackoverflow.com/questions/28488986/formal-parameter-with-declspecalign16-wont-be-aligned
The text was updated successfully, but these errors were encountered: