aclements / libelfin

C++11 ELF/DWARF parser
MIT License
314 stars 99 forks source link

don't use a VLA just to compute a buffer size #82

Open schopin-pro opened 4 months ago

schopin-pro commented 4 months ago

VLAs in C++ are compiler extensions, and clang 18 will complain about it.

Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/libelfin/+bug/2060786 Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1065084

stephan-cr commented 3 months ago

I wonder why the compiler doesn't complain about similar lines of code like:

https://github.com/aclements/libelfin/blob/ca2b127a7a9ea5685873816805609b80e254b4da/dwarf/small_vector.hh#L24

schopin-pro commented 3 months ago

In the case you pointed to, Min is not a variable but a template parameter, i.e. a compile-time constant.