libelfin icon indicating copy to clipboard operation
libelfin copied to clipboard

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

Open schopin-pro opened this issue 1 year ago • 2 comments

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

schopin-pro avatar Apr 10 '24 09:04 schopin-pro

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

stephan-cr avatar May 23 '24 07:05 stephan-cr

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

schopin-pro avatar May 23 '24 07:05 schopin-pro