artem-ogre / CDT

Constrained Delaunay Triangulation (C++)
https://artem-ogre.github.io/CDT/
Mozilla Public License 2.0
947 stars 125 forks source link

Tiny compilation warning (VS2019) #163

Closed LeoPizzo1 closed 7 months ago

LeoPizzo1 commented 7 months ago

Using the library and defining CDT_USE_64_BIT_INDEX_TYPE, during the compilation I get this warning: CDT\include\Triangulation.hpp(1497,32): warning C4244: 'initializing': conversion from 'const _Ty' to 'CDT::Index', possible loss of data

It refers to:

        const Index iDupe = v1 == v   ? t.vertices[0]
                            : v2 == v ? t.vertices[1]
                                      : t.vertices[2];

where Indexis an unsigned char, and t.verticesvector contains an unsigned long long.

artem-ogre commented 7 months ago

Thanks for spotting and reporting @LeoPizzo1 :smiley:

artem-ogre commented 7 months ago

Did it fix the warning? Side note: Do you really need 64 bit indices? I think 32bit is enough for 99.99% use cases

LeoPizzo1 commented 7 months ago

Yes, it is solved.

In any case, no, I do not actually need 64 bit indices: probably I will avoid them.

Anyway, using 32 bit indices I get several other warnings: I am compiling with Level 3 (/W3).

CDT\include\Triangulation.hpp(1947,1): warning C4267: 'initializing': conversion from 'size_t' to 'CDT::VertInd', possible loss of data CDT\include\Triangulation.hpp(1947,1): warning C4267: 'initializing': conversion from 'size_t' to 'const CDT::VertInd', possible loss of data CDT\include\Triangulation.hpp(588,1): warning C4267: 'argument': conversion from 'size_t' to 'CDT::VertInd', possible loss of data CDT\include\Triangulation.hpp(589,1): warning C4267: 'argument': conversion from 'size_t' to 'CDT::VertInd', possible loss of data CDT\include\Triangulation.hpp(1500,1): warning C4267: 'argument': conversion from 'size_t' to 'const CDT::VertInd', possible loss of data

artem-ogre commented 7 months ago

could you check if the warnings a gone?

artem-ogre commented 7 months ago

I actually get the warnings in my GitHub actions CI, I will fix them.

LeoPizzo1 commented 7 months ago

Warnings gone, thanks!