wdas / SeExpr

SeExpr is an embeddable, arithmetic expression language that enables flexible artistic control and customization in creating computer graphics images. Example uses include procedural geometry synthesis, image synthesis, simulation control, crowd animation, and geometry deformation. https://wdas.github.io/SeExpr
https://www.disneyanimation.com/open-source/seexpr/
Other
404 stars 87 forks source link

compiling on windows with vS2022 #109

Open craouette opened 3 months ago

craouette commented 3 months ago

Hi,

In order to compile on windows with Visual studio 2022, I needed to:

from inline double log2(double x) { return log(x) 1.4426950408889634; } to //inline double log2(double x) { return log(x) 1.4426950408889634; }

from const unsigned char* ptrs[height]; to unsigned char* ptrs = new unsigned char[height];

from const unsigned char* ptrs[height]; to unsigned char* ptrs = new unsigned char[height];

These changes should not impact other platform.

Pierre

davvid commented 2 months ago

Are there parts of this something you might be able to contribute behind some #if defined(WIN32) macro guards?

Why do you have to comment-out log2, btw? Is that name a windows-only thing or is it hitting some other compile error?

For the unsigned char** ptrs = new unsigned char*[height]; change -- that's a memory leak. I'd recommend storing it in a std::unique_ptr<unsigned char> instead so that it avoids the leak.

It is true that the current use of const unsigned char* ptrs[height]; is a GCC extension ("variable-length arrays"), so replacing that would be worth it IMO.