C++ Logo


Advanced search

Re: [std-proposals] Impose friendship when needed

From: Giuseppe D'Angelo <giuseppe.dangelo_at_[hidden]>
Date: Tue, 19 Jul 2022 08:07:36 +0200
Il 18/07/22 12:26, Sebastian Wittmeier via Std-Proposals ha scritto:
> If the library was compiled in binary form, changing the access modifier
> can break compatibility of class layout. But under controlled
> circumstances this could be a successful hack (and its success can be
> automatically tested with offsetof, etc., for each class member)

Even simpler than this: you can't #define a language keyword.


> A translation unit shall not #define or #undef names lexically identical to keywords, to the identifiers listed in Table 4, or to the attribute-tokens described in [dcl.attr], except that the names likely and unlikely may be defined as function-like macros ([cpp.replace]).

My 2 c,
Giuseppe D'Angelo | giuseppe.dangelo_at_[hidden] | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - The Qt, C++ and OpenGL Experts

Received on 2022-07-19 06:07:40