Skip to content

Commit d856989

Browse files
ldm5180random-zebra
authored andcommitted
warnings: Compiler warning on memset usage for non-trivial type
Problem: - IS_TRIVIALLY_CONSTRUCTIBLE macro does not work correctly resulting in `memset()` usage to set a non-trivial type to 0 when `nontrivial_t` is passed in from the tests. - Warning reported by GCC when compiling with `--enable-werror`. Solution: - Use the standard algorithm `std::fill_n()` and let the compiler determine the optimal way of looping or using `memset()`.
1 parent 4cb188e commit d856989

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/prevector.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
#include <stdint.h>
1111
#include <string.h>
1212

13+
#include <algorithm>
14+
#include <cstddef>
1315
#include <iterator>
1416
#include <type_traits>
1517

0 commit comments

Comments
 (0)