Re: Converting enums to pointers
From: Rolf Magnus (ramagnus_at_t-online.de)
Date: 10/11/04
- Next message: Rolf Magnus: "Re: Newbie question on unions"
- Previous message: Patrick Kowalzick: "Re: Templated identity matrix with parameterize order?"
- In reply to: Ron Natalie: "Re: Converting enums to pointers"
- Next in thread: James Aguilar: "Re: Converting enums to pointers"
- Reply: James Aguilar: "Re: Converting enums to pointers"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 11 Oct 2004 12:02:41 +0200
Ron Natalie wrote:
> James Aguilar wrote:
>
>> const Record* EMPTY = (Record*) 0;
>
> You declare EMPTY to be a null pointer here. This is legitimate.
Yes, and it doesn't actually need a cast.
>> const Record* DELETED = (Record*) 1;
>
> This is implementation defined and may not universally work. Nothing
> guarantees you can reinterpret cast an arbitrary integer to a pointer
> type.
And nothing guarantess that the resulting pointer value is not one that
points to an existing object.
>> But if I do that I have lost all the convenience of the enumerated type.
>>
> const Record DELETED;
> would work, of course it allocates an unused Record object.
- Next message: Rolf Magnus: "Re: Newbie question on unions"
- Previous message: Patrick Kowalzick: "Re: Templated identity matrix with parameterize order?"
- In reply to: Ron Natalie: "Re: Converting enums to pointers"
- Next in thread: James Aguilar: "Re: Converting enums to pointers"
- Reply: James Aguilar: "Re: Converting enums to pointers"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|