Board index » cppbuilder » Assigning Pointer to Tag-Property

Assigning Pointer to Tag-Property

Hello,

I'm looking for an example which assigns
a Pointer to the Tag-Property (and reassigns
it..)

Thank you very much.

Udo Weik
Engineering Office, Germany

 

Re:Assigning Pointer to Tag-Property


Are you willing to have non-portable code?  At best, you can *hope*
for a compiler "Conversion will lose significant bits" sort of warning
*if* an "int" happens to not be large enough to hold a pointer on the
target system.  It might be more conservative to find another way to
squeze the reference into a Tag property.
-------
Timothy H. Buchman
========================================
City Center Theater, New York NY
mailto:tbuchmanREMOVE@NO_SPAMcitycenter.org
Please treat this signature information as confidential.
========================================
Search .borland message archive on http://www.mers.com/searchsite.html

Quote
Udo Weik <WeikEng...@aol.com> wrote in message

news:39DCECC2.333F3356@aol.com...
Quote
> Hello,

> I'm looking for an example which assigns
> a Pointer to the Tag-Property (and reassigns
> it..)

> Thank you very much.

> Udo Weik
> Engineering Office, Germany

Re:Assigning Pointer to Tag-Property


On Thu, 05 Oct 2000 23:04:02 +0200, Udo Weik <WeikEng...@aol.com>
wrote:

Quote
>I'm looking for an example which assigns
>a Pointer to the Tag-Property (and reassigns
>it..)

It's not a very robust thing to do, because Tag is an int, which may
not fully hold a pointer on other OSes. It's much better to have the
tag value used to look up the pointer in a table, or something like
that.

Anyway, just cast the pointer to int, and the Tag to the pointer type,
like this:
  ptr = (Pointer*)obj->Tag;
  obj->Tag = (int)ptr;

Other Threads