sarah-walker-pcem / pcem

PCem
http://pcem-emulator.co.uk
GNU General Public License v2.0
1.47k stars 204 forks source link

Get rid of VLAs. #199

Closed MarekKnapek closed 1 year ago

MarekKnapek commented 1 year ago

Hi, VLAs (variable-lenght-arrays) in C language are evil, their size is computed at run-time (and they are most likely allocated by using alloca). In many cases we know the worst possible size the array will ever have at compile-time. It is better to compute size of such array at compile-time rather than at run-time. This is also step forward to be able to compile pcem by MSVC as it does not support VLAs.

unreal9010 commented 1 year ago

Good work! This has helped to slightly speed some things up.