Date: Fri, 18 Oct 2024 11:56:07 +0200
On 18/10/2024 11.13, Marcin Jaczewski wrote:
> czw., 17 paź 2024 o 16:58 Federico Kircheis via Std-Discussion
> <std-discussion_at_[hidden]> napisał(a):
>>
>> Hello,
>>
>> I would like to have, in c++, a way to "register" objects from different
>> translation units in a global container (an array).
>>
>> This is already possible in gcc and msvc with tools outside of the
>> language, with multiple drawbacks.
>>
>
> It needs to be `array`? If we allow linked list each position can
> "self append" to global list:
>
I want to standardize existing practice, not propose something novel.
Existing practice
* works with something that looks like an array
* does not execute code at runtime during the registration
* does not require mutable memory, which is a security issue (see the
EncodePointer function :
https://learn.microsoft.com/en-us/previous-versions/bb432254(v=vs.85) )
The proposed linked list cannot be compared with such approach.
I was also thinking that exposing span or initializer_list are viable
alternatives.
They have the advantage that there is no need for a second symbol for
tracking the size.
> czw., 17 paź 2024 o 16:58 Federico Kircheis via Std-Discussion
> <std-discussion_at_[hidden]> napisał(a):
>>
>> Hello,
>>
>> I would like to have, in c++, a way to "register" objects from different
>> translation units in a global container (an array).
>>
>> This is already possible in gcc and msvc with tools outside of the
>> language, with multiple drawbacks.
>>
>
> It needs to be `array`? If we allow linked list each position can
> "self append" to global list:
>
I want to standardize existing practice, not propose something novel.
Existing practice
* works with something that looks like an array
* does not execute code at runtime during the registration
* does not require mutable memory, which is a security issue (see the
EncodePointer function :
https://learn.microsoft.com/en-us/previous-versions/bb432254(v=vs.85) )
The proposed linked list cannot be compared with such approach.
I was also thinking that exposing span or initializer_list are viable
alternatives.
They have the advantage that there is no need for a second symbol for
tracking the size.
Received on 2024-10-18 09:56:17