Fix for variable length array initialization error.#986
Fix for variable length array initialization error.#986YLouWashU wants to merge 1 commit intostevenlovegrove:masterfrom
Conversation
|
Would this also work if you use |
I can't use constexpr because 'zl' is not compile time const. And also, can you remind me what is mac runner? Thanks! |
|
I assume you are trying to fix #985. There, we hypothesised that this is likely caused by newer macOS / AppleClang version. The CI is using macOS 14 and the issue seems to appear on macOS 15. So updating the CI pipeline here: Pangolin/.github/workflows/build.yml Line 19 in 122bb3e |
| std::vector<GLfloat> zsVec(zsize); | ||
| GLfloat* zs = zsVec.data(); |
There was a problem hiding this comment.
Why do you allocate the memory through a std::vector and not malloc/free?
Or the other way around, if you already allocated the memory for the std::vector<GLfloat> why aren't you reusing this vector and just use the data pointer wherever zs is used?
Also, when you turn this into a dynamic array, you can remove the MSVC workaround above.
|
I updated the runner, enabled VLA errors to have this triggered when new VLAs are added, and I replaced the |
Thanks so much for the fix Christian! I have tested your PR on my end and it is working. Let's land yours instead. I will close this PR. Closing because #987 is a more proper fix. |
This PR addresses the following issue:
On Mac-ARM64 computer when building from source, I got the following errors:
This is caused by compiler not allowing creation of variable length array.
This PR addresses this by creating a pointer that points to the data member of a std::vector.