#Usage of _Alignas

1 messages · Page 1 of 1 (latest)

supple mulch
#

What are actual usages of _Alignas operator?

I mean, I know what it does, but I think that I only ever had once a need to control some alignment, and it was when writing an allocator based on a unsigned char [] array. This actually triggers UB. as it violates strict aliasing rules. (unless you have some pointer laundry or know a bit about your compiler. but anyway this is not the point)

however, such case feels quite niche and I'm wondering why would one need such operator in practice?

gritty fernBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

clever wolf