TokTok / c-toxcore

The future of online communications.
https://tox.chat
GNU General Public License v3.0
2.28k stars 286 forks source link

Get rid of all VLAs #959

Open iphydf opened 6 years ago

iphydf commented 6 years ago

We should replace them with regular stack allocations. VLAs are hard for static analysis to ensure that no stack overflow can happen. VLAs are also not supported on all platforms we are targeting, resulting in an ugly ccompat.h. I'd like to get rid of ccompat.h completely, and the main blocker for that is our use of VLAs.

tvladyslav commented 5 years ago

ccompat.h is used mostly for nullptr:

#if !defined(__cplusplus) || __cplusplus < 201103L
#define nullptr NULL
#endif

Where can we move this definition? tox.h? unil.h? Or a separate header for this definition only?