Giter VIP home page Giter VIP logo

Comments (14)

coastwise avatar coastwise commented on May 18, 2024

Sorry, forgot to mention that this is with v1.5.0

from handmademath.

RandyGaul avatar RandyGaul commented on May 18, 2024

Enable __vectorcall https://msdn.microsoft.com/en-us/library/dn375768.aspx.

from handmademath.

StrangeZak avatar StrangeZak commented on May 18, 2024

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 ?

from handmademath.

coastwise avatar coastwise commented on May 18, 2024

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,
Patrick

from handmademath.

StrangeZak avatar StrangeZak commented on May 18, 2024

If you compiled with x64 it wouldn't be an issue, but i understand that isn't the real solution here

from handmademath.

StrangeZak avatar StrangeZak commented on May 18, 2024

@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?

from handmademath.

coastwise avatar coastwise commented on May 18, 2024

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

from handmademath.

StrangeZak avatar StrangeZak commented on May 18, 2024

Thanks!

from handmademath.

StrangeZak avatar StrangeZak commented on May 18, 2024

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

from handmademath.

kavika13 avatar kavika13 commented on May 18, 2024

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.

from handmademath.

StrangeZak avatar StrangeZak commented on May 18, 2024

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

from handmademath.

StrangeZak avatar StrangeZak commented on May 18, 2024

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.

S:\Handmade-Math>cl main.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 19.15.26726 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

main.cpp
Microsoft (R) Incremental Linker Version 14.15.26726.0
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:main.exe
main.obj

S:\Handmade-Math>cl main.c
Microsoft (R) C/C++ Optimizing Compiler Version 19.15.26726 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

main.c
Microsoft (R) Incremental Linker Version 14.15.26726.0
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:main.exe
main.obj

from handmademath.

kavika13 avatar kavika13 commented on May 18, 2024

main.cpp and main.c aren't in the repo, so I don't know what files you are compiling.

If you just include the HandmadeMath.h header and don't actually pass parameters to the affected functions then you won't get these alignment errors. You also won't actually be using any of the functions, so that's not super useful. Hence why I'm trying to compile the test suite :)

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:

λ cl hmm_test.c HandmadeMath.c
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24215.1 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

hmm_test.c
c:\users\myusername\dev\handmade-math\test\../HandmadeMath.h(757): error C2719: 'Left': formal parameter with requested alignment of 16 won't be aligned
c:\users\myusername\dev\handmade-math\test\../HandmadeMath.h(757): error C2719: 'Right': formal parameter with requested alignment of 16 won't be aligned
c:\users\myusername\dev\handmade-math\test\../HandmadeMath.h(794): error C2719: 'Left': formal parameter with requested alignment of 16 won't be aligned
c:\users\myusername\dev\handmade-math\test\../HandmadeMath.h(794): error C2719: 'Right': formal parameter with requested alignment of 16 won't be aligned
c:\users\myusername\dev\handmade-math\test\../HandmadeMath.h(852): error C2719: 'Left': formal parameter with requested alignment of 16 won't be aligned
c:\users\myusername\dev\handmade-math\test\../HandmadeMath.h(852): error C2719: 'Right': formal parameter with requested alignment of 16 won't be aligned
c:\users\myusername\dev\handmade-math\test\../HandmadeMath.h(868): error C2719: 'Left': formal parameter with requested alignment of 16 won't be aligned
c:\users\myusername\dev\handmade-math\test\../HandmadeMath.h(927): error C2719: 'Left': formal parameter with requested alignment of 16 won't be aligned
c:\users\myusername\dev\handmade-math\test\../HandmadeMath.h(927): error C2719: 'Right': formal parameter with requested alignment of 16 won't be aligned
... lots more of these ...

VS 2017:

λ cl hmm_test.c HandmadeMath.c
Microsoft (R) C/C++ Optimizing Compiler Version 19.15.26726 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

hmm_test.c
HandmadeMath.c
Generating Code...
Microsoft (R) Incremental Linker Version 14.15.26726.0
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:hmm_test.exe
hmm_test.obj
HandmadeMath.obj

With the VS 2017 compile, I also get 100% of tests passing when I run hmm_test.exe.

from handmademath.

StrangeZak avatar StrangeZak commented on May 18, 2024

Seems ill have to get VS2015 installed and get back to you. I LOVE when compiler updates change things haha.

from handmademath.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.