C++ Logo

sg12

Advanced search

Re: [isocpp-ext] Total order for pointer comparisons (again)

From: Jₑₙₛ Gustedt <jens.gustedt_at_[hidden]>
Date: Tue, 28 Nov 2023 11:16:48 +0100
Alisdair,

on Tue, 28 Nov 2023 17:07:44 +0700 you (Alisdair Meredith via Ext
<ext_at_[hidden]>) wrote:

> There is also the issue that `offsetof` returns an interesting value,
> but cannot be used to access the data member at that offset by any
> valid pointer arithmetic from the address of the complete object
> itself.

In C++ this might be subtly different, but the model in C is that if
you convert a pointer to the complete object to `unsigned char*`, this
gives you a valid pointer to an array that spans the whole object.
Within this array you can use the offsets that this macro provides.

Thanks
Jₑₙₛ

-- 
:: ICube :::::::::::::::::::::::::::::: deputy director ::
:: Université de Strasbourg :::::::::::::::::::::: ICPS ::
:: INRIA Nancy Grand Est :::::::::::::::::::::::: Camus ::
:: :::::::::::::::::::::::::::::::::::: ☎ +33 368854536 ::
:: https://icube-icps.unistra.fr/index.php/Jens_Gustedt ::

Received on 2023-11-28 10:16:51