openexr icon indicating copy to clipboard operation
openexr copied to clipboard

Imath includes shall be guarded

Open sanguinariojoe opened this issue 2 years ago • 1 comments
trafficstars

You are many times doing dangerous includes:

https://github.com/AcademySoftwareFoundation/openexr/blob/main/src/lib/OpenEXRCore/internal_coding.h#L24

While you should do the guarded version:

#include <Imath/half.h>

There are 2 main reasons that make your way suboptimal:

  • Collisions. How many projects can have a half.h header file? Any other project with such a file, which is either not guarding the header or including it like you do, will cause a collision
  • Exotic makefiles. With CMake this is not a big deal (or maybe it is...), but it is definitely a pain in the ass on other building systems. It is indeed impossible to use Imath when installed on a custom folder.

sanguinariojoe avatar Oct 17 '23 14:10 sanguinariojoe

That would be a good thing to address, thanks for pointing it out.

meshula avatar Oct 20 '23 00:10 meshula