we now have a coding guide

This commit is contained in:
2026-04-01 19:45:59 +02:00
parent fd9aba2812
commit 13fc83b20b
2 changed files with 47 additions and 1 deletions

View File

@@ -60,7 +60,9 @@ extern "C" {
*/
// Test: gcc -E -DNN_VLA\(type,name,count\)="type name[count]" -x c - <<< 'NN_VLA(const char *, comps, len);'
#ifdef _MSC_VER
#include <malloc.h>
// avoid #include <malloc.h>, for it can pollute the namespace
// with symbols to functions which are not linked with in baremetal.
void *_alloca(size_t);
#define NN_VLA(type, name, count) type *name = (type *)_alloca(sizeof(type) * (count))
#else
#define NN_VLA(type, name, count) type name[count]