1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/ext/-test-/RUBY_ALIGNOF/cpp.cpp
卜部昌平 0b77a86d1e ext/-test-/RUBY_ALIGNOF: add minimalistic test
Check if RUBY_ALIGNOF(double) is the alignment to store a double inside
of a struct.
2020-09-25 11:38:33 +09:00

15 lines
249 B
C++

#include "ruby.h"
#include <cstddef>
struct T {
char _;
double t;
};
RBIMPL_STATIC_ASSERT(RUBY_ALIGNOF, RUBY_ALIGNOF(double) == offsetof(T, t));
extern "C" void
Init_RUBY_ALIGNOF()
{
// Windows linker mandates this symbol to exist.
}