Skip to content

Commit

Permalink
Add helper macros for structure size and member offset validation
Browse files Browse the repository at this point in the history
  • Loading branch information
Blumster committed Sep 7, 2024
1 parent c8f1f2d commit 50f5ef8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions NMF.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
type& operator=(const type&) = delete; \
type& operator=(type&&) = delete;

#define ASSERT_CLASS_SIZE(class, size) static_assert(sizeof(class) == size, "Size of " #class " doesn't match expected size " #size "!")
#define ASSERT_CLASS_MEMBER_OFFSET(class, member, offset) static_assert(offsetof(class, member) == offset, "Offset of " #member " in class " #class " doesn't match expected offset " #offset "!")

namespace NMF
{
enum class NMFExitCode : int32_t
Expand Down

0 comments on commit 50f5ef8

Please sign in to comment.