Re: same-address mappings vs. relative pointers

From: Florian Pflug <fgp(at)phlo(dot)org>
To: Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: same-address mappings vs. relative pointers
Date: 2013-12-11 10:42:25
Message-ID: 6595D7FC-7EB4-4A8D-80EF-AF81766BF5C8@phlo.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Dec5, 2013, at 15:44 , Andres Freund <andres(at)2ndquadrant(dot)com> wrote:
> There might be some ugly compiler dependent magic we could do. Depending
> on how we decide to declare offsets. Like (very, very roughly)
>
> #define relptr(type, struct_name, varname) union struct_name##_##varname{ \
> type relptr_type; \
> Offset relptr_off;
> }
>
> And then, for accessing have:
> #define relptr_access(seg, off) \
> typeof(off.relptr_type)* (((char *)seg->base_address) + off.relptr_off)
>
> But boy, that's ugly.

Well, uglyness we can live with, especially if it's less ugly than the
alternatives. But I'm afraid is also unportable - typeof() is a GCC
extension, not a part of ANSI C, no?

best regards,
Florian Pflug

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2013-12-11 10:47:37 Re: same-address mappings vs. relative pointers
Previous Message hubert depesz lubaczewski 2013-12-11 10:41:10 Re: Question about sorting internals