Warning: mysqli::__construct(): (HY000/1203): User howardkn already has more than 'max_user_connections' active connections in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\includes\artfuncs.php on line 21
Failed to connect to MySQL: (1203) User howardkn already has more than 'max_user_connections' active connections
Warning: mysqli::query(): Couldn't fetch mysqli in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\index.php on line 66
Article <v2ql2i$2egjm$1@dont-email.me>
Deutsch   English   Français   Italiano  
<v2ql2i$2egjm$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!2.eu.feeder.erje.net!3.eu.feeder.erje.net!feeder.erje.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>
Newsgroups: comp.lang.c
Subject: Re: C23 thoughts and opinions
Date: Fri, 24 May 2024 11:08:16 -0700
Organization: A noiseless patient Spider
Lines: 64
Message-ID: <v2ql2i$2egjm$1@dont-email.me>
References: <v2l828$18v7f$1@dont-email.me> <v2lnr5$1bu1r$1@dont-email.me>
 <v2ngmp$1p3o2$3@dont-email.me> <v2oi32$1vebu$1@dont-email.me>
 <v2q9fk$2cb7s$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 24 May 2024 20:08:18 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="a99698c67443521d1279cccaa6d71273";
	logging-data="2572918"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+t1A/m4JPbOZLE/MsRa+JGdwmIwpd4ERE="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:wmDZTMWaDqeHc2fsSx0bHhiC88s=
Content-Language: en-US
In-Reply-To: <v2q9fk$2cb7s$1@dont-email.me>
Bytes: 4000

On 5/24/2024 7:50 AM, David Brown wrote:
> On 24/05/2024 01:05, Chris M. Thomasson wrote:
>> On 5/23/2024 6:35 AM, David Brown wrote:
>>> 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 (now as a keyword in C23, instead of just _Alignas 
> from C11).
> 
> 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>.

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.

Iirc, I can make std::vector align its elements to say, L2 cachelines, 
and I can make std::vector align itself on a large boundary say 8192 
bytes. All in std C++! That is nice.

Any point in the block can round itself down to the nearest 8192 block, 
then we have direct access to its header. Also, then I make a rule that 
each memory block in a region is at least the size of a pointer. Then I 
can use them in a lock-free stack, or something. This is damn near zero 
overhead.

I have posted about some of these allocators in the past.


> Perhaps I should just be grateful for the small mercy of there being no 
> random youtube link in your post.

No shit. ;^)