Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upCannot take the compile-time sizeof Atomic types #12726
Open
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment


sizeofdoesn't work for types that store Atomics. This would be useful to size the memory buffer for thread-safe memory allocators with what is left from the synchronization primitives.The workaround is to add a "raw" field for all the trivial types with their actual types so that sizeof works.
There is a similar concern for Locks and Condition Variables though I don't think there is an easy way to make sizeof deduce their size.