mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-21 20:28:27 +00:00
[C++] Got rid of memset's in constructors (#5938)
* [C++] removed array's memsets from struct parametrized constructor now POD-typed arrays are zero-initialized and class-typed arrays are default-initialized * [C++] memset -> zero/default initialization in default constructor * [C++] Struct-type and array default initialization * [C++] Newly generated tests * [C++] forgotten test * [C++] curly brace by code style * [C++] test if memory is 0's after placement new * [C++] memory leak fix * [C++] simplifying and non-dynamic memory in test * [C++] code cleanup * [C++] disable old-compiler warning * [C++] windows build fix (try) * [C++] debug-new win build fix
This commit is contained in:
@@ -202,8 +202,8 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) Rapunzel FLATBUFFERS_FINAL_CLASS {
|
||||
static const flatbuffers::TypeTable *MiniReflectTypeTable() {
|
||||
return RapunzelTypeTable();
|
||||
}
|
||||
Rapunzel() {
|
||||
memset(static_cast<void *>(this), 0, sizeof(Rapunzel));
|
||||
Rapunzel()
|
||||
: hair_length_(0) {
|
||||
}
|
||||
Rapunzel(int32_t _hair_length)
|
||||
: hair_length_(flatbuffers::EndianScalar(_hair_length)) {
|
||||
@@ -235,8 +235,8 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) BookReader FLATBUFFERS_FINAL_CLASS {
|
||||
static const flatbuffers::TypeTable *MiniReflectTypeTable() {
|
||||
return BookReaderTypeTable();
|
||||
}
|
||||
BookReader() {
|
||||
memset(static_cast<void *>(this), 0, sizeof(BookReader));
|
||||
BookReader()
|
||||
: books_read_(0) {
|
||||
}
|
||||
BookReader(int32_t _books_read)
|
||||
: books_read_(flatbuffers::EndianScalar(_books_read)) {
|
||||
|
||||
Reference in New Issue
Block a user