I have cases where I need to alloca
space for an object with size, layout, and alignment that is unknown at compile time. These values are accessible at runtime, but as far as I can tell, the align
attribute on an alloca
instruction must be compile-time constant, rather than an instruction argument.
How can I safely obtain an align
value which will be strict enough to align to any primitive data type on the target platform? (The equivalent of this in C++ would be alignof(std::max_align_t)
).