mirror of
https://github.com/ruby/ruby.git
synced 2025-09-16 00:54:01 +02:00
ext/-test-/RUBY_ALIGNOF: add minimalistic test
Check if RUBY_ALIGNOF(double) is the alignment to store a double inside of a struct.
This commit is contained in:
parent
873fb1aa4c
commit
0b77a86d1e
Notes:
git
2020-09-25 11:39:05 +09:00
4 changed files with 189 additions and 0 deletions
15
ext/-test-/RUBY_ALIGNOF/cpp.cpp
Normal file
15
ext/-test-/RUBY_ALIGNOF/cpp.cpp
Normal file
|
@ -0,0 +1,15 @@
|
|||
#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.
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue