Просмотр исходного кода

Fix build using cl.exe

https://en.cppreference.com/w/c/language/array

`Zero-length array declarations are not allowed, even though some compilers offer them as extensions (typically as a pre-C99 implementation of flexible array members).`

This is needed to build catboost for Windows.
spreis 2 лет назад
Родитель
Сommit
458c063b72
1 измененных файлов с 3 добавлено и 1 удалено
  1. 3 1
      library/cpp/yt/memory/chunked_memory_allocator.h

+ 3 - 1
library/cpp/yt/memory/chunked_memory_allocator.h

@@ -44,7 +44,9 @@ private:
     const i64 MaxSmallBlockSize_;
     const TRefCountedTypeCookie TagCookie_;
 
-    char EmptyBuf_[0];
+    // Zero-sized arrays are prohibited by C++ standard
+    // Also even if supported they actually occupy some space (usually 1 byte)
+    char EmptyBuf_[1];
 
     // Chunk memory layout:
     //   |AAAA|....|UUUU|