Date: Fri, 8 Mar 2024 00:17:35 +0100
Dear Veronica,
what about your mentioned alternative of anonymous unions and structs?
They could be made standard-compliant.
And would need less language changes.
 
Would they have problems with UB due to which element is the active one? When used in your use case?
 
Best regards,
Sebastian
 
-----Ursprüngliche Nachricht-----
Von:veronica alphonso via Std-Proposals <std-proposals_at_[hidden]>
Gesendet:Do 07.03.2024 23:55
Betreff:[std-proposals] Subscript aliasing
An:std-proposals_at_[hidden]; 
CC:veronica alphonso <verodeving_at_[hidden]>; 
 
In C++ there isn't a standard-compliant way of creating named aliases of c-like array elements. In certain contexts, it is preferred to access these these array elements with a named identifier that is bounded to that particular array entry, e.g:
union
{
    float my_vec[3];
    struct
    {
        float x, y, z;
    };
};
However, anonymous structs/classes are only
 
-- 
 Std-Proposals mailing list
 Std-Proposals_at_[hidden]
 https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
 
 
Received on 2024-03-07 23:17:37
