I64vec2 copy constructor suddenly starts decomposing things

Okay, I'm sorry. It seems that Visual Studio just went crazy and the values ​​are REALLY beautiful. As for why this happens and when, I have no idea.

At the end there is a complete sample, I would like to know if it does this crazy thing for you. Try creating x86 and x64 assemblies and see what the debugger says.

This may be good, but now I will not miss unnecessary copying.


I find it really strange. Whenever I copy glm :: i64vec2, it becomes damaged.

But if I only do this line:

glm::i64vec2 copy(glm::i64vec2(1, 1));

It basically works for me. I deleted all the object files and rebuilt the program from scratch .. any ideas what might be wrong?

The only thing I can think of is that I included the headers in a different order in different places and messed it up something.

What I really should use here is a reference to const, but still it scares me. One of them can easily remain hidden as a mistake and cause a lot of headache for me.

Fine

!  Fine


I just found another mistake. This time it happens inside the same class.

It fails, but the same thing works basically

bool test(glm::i64vec2 p_worldPos)
{
  return p_worldPos.x == 1;
}

void QuadTree::getObjectsHitInPriority(glm::i64vec2 const & p_worldPos, std::vector<Object*> & p_objects)
{
  test(p_worldPos);

Um, I don't know what this means, but the following observation was made. In my main.cpp program this does not work

#include <glm/glm.hpp>
#include <iostream>

struct whatthehell
{
    bool test(glm::u64vec2 p_test)
    {
        return p_test.x == 1;
    }
};

int main(int argc, char ** argv)
{
    whatthehell hell;

    if (hell.test(glm::u64vec2(1, 1)) == false)
    {
        std::cout << "What the hell\n";
    }

    return 0;
}

Ok, upgrade. This works with x86, but not with x64 with my VS2015. Can anyone check this out?

+4
source share

No one has answered this question yet.

Source: https://habr.com/ru/post/1608859/


All Articles