[cfe-dev] Fixing selector types on the GNU runtime
Sebastian Redl
sebastian.redl at getdesigned.at
Wed Jan 21 13:24:27 PST 2009
Mike Stump wrote:
> On Jan 21, 2009, at 11:07 AM, David Chisnall wrote:
>
>> On 21 Jan 2009, at 19:04, Mike Stump wrote:
>>
>>
>>> On Jan 21, 2009, at 4:18 AM, David Chisnall wrote:
>>>
>>>> my diff will avoid real issues on platforms like Win64, where 0
>>>> and 0L, the two suggested definitions of NULL from the standard,
>>>> are both smaller than pointers.
>>>>
>>> What _is_ NULL defined to on Win64?
>>>
All the VC++ headers I have available currently define it as 0,
regardless of platform. However, these are variants that do not really
support 64-bit compilation. I can look tomorrow at a definitely 64-bit
capable version. On the other hand, I don't think MS changes the CRT
headers between the Express and the Professional edition.
>> I presume that depends on the compiler you use and the headers you
>> include...
>>
>
> On those platforms for which it will fix real issues as quoted above.
> This excludes clang, g++, llvm-g++ to name a few where I'm reasonably
> certain there will be no problems. I'm trying to ascertain if you are
> raising a theoretic point, or a real issue. Anyway, seems more
> reliable to just redefine NULL on those platforms that define it
> incorrectly for our needs, as otherwise people will put in NULL, and
> people will likely miss converting it.
>
> To help ensure we never have an issue, we could:
>
> assert (sizeof (NULL) == sizeof (void *));
>
> someplace.
>
Better yet, assert this statically:
typedef int null_must_have_pointer_size[sizeof(NULL) == sizeof(void*)];
Sebastian
More information about the cfe-dev
mailing list