[fpc-pascal] pointer to anything
Doug Chamberlin
dougchamberlin at earthlink.net
Fri Apr 23 14:17:21 CEST 2010
On 4/23/2010 3:33 AM, spir ☣ wrote:
> Say I want to implement a kind of linked list which node data may be anything. Thus I cannot store data on place (in nodes), indeed; so it should be referenced. But pointers themselves are supposed to be typed. So, how can I do that?
>
The key to solving this problem is to answer the question "How will I
know what type of data that pointer points to?" Once you determine what
is being pointed to you can cast Pointer^ to that type and all should work.
I would use Pointer as an untyped pointer to anything and ignore the
warning. Perhaps you can turn off that warning for this code segment
since you are doing this intentionally.
--
Doug C.
-----
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?
More information about the fpc-pascal
mailing list