Liste des Groupes | Revenir à cl c |
On 24/05/2024 01:05, Chris M. Thomasson wrote:alignas is very nice because it can help me make a 100% portable version of some of my old exotic lock-free memory allocators that use rounding to get down to a header. Any point in the region can be rounded down to get at the header for the block. It involves aligning the main region on a large boundary, say 8192 bytes. This is a little trick for high performance lock-free allocators.On 5/23/2024 6:35 AM, David Brown wrote:I know C has alignas (now as a keyword in C23, instead of just _Alignas from C11).On 22/05/2024 23:24, Chris M. Thomasson wrote:>On 5/22/2024 9:55 AM, David Brown wrote:>In an attempt to bring some topicality to the group, has anyone started using, or considering, C23 ? There's quite a lot of change in it, especially compared to the minor changes in C17.>
Love the way std::vectors respect alignas... C++20, iirc?
>
[...]
I have no idea what you are talking about.
std::vector actually respects alignas, on MSVC at least. I did not know this worked until I tried it. Iirc, Bonita was the one that sparked my test. It aligned itself on the proper boundaries. Very nice.
>But did you notice that this is c.l.c, not c.l.c++, and the topic is C23, not C++23 ? Discussing comparisons or compatibility with C++ is fair enough, but talking about pure C++ matters (such as std::vector<>) is unlikely to be helpful.>
C has it as well... Very useful!
I know C++ has alignas (from C++11 onwards).
What I don't understand is why you think std::vector<> "respects alignas" in C++20 - alignment for std::vector<> works like alignment for any other class in C++, and always has done.
And what I /really/ don't understand is why you think it is remotely relevant here? Even "alignas" in C is not particular relevant to this thread, except that it has become a keyword in C23 instead of a macro defined to _Alignas in <stdalign.h>.
Perhaps I should just be grateful for the small mercy of there being no random youtube link in your post.No shit. ;^)
Les messages affichés proviennent d'usenet.