Article View: comp.lang.c.moderated
Article #2345how do I typedef an array of pointers to a structure?
From: Timur Tabi
Date: Wed, 20 Mar 1996 04:30
Date: Wed, 20 Mar 1996 04:30
34 lines
1900 bytes
1900 bytes
Ok, I've changed things a little bit. This is the code I have now: class NODE; typedef NODE *PNODE; // PNODE is a pointer to a node typedef PNODE NODE_LINKS[]; // NODE_LINKS is an array of pointers to nodes typedef NODE_LINKS *PNODE_LINKS; // PNODE_LINKS is a pointer to a NODE_LINK typedef PNODE_LINKS NODE_SLOTS[]; // NODE_SLOTS is an array of PNODE_LINKS typedef NODE_SLOTS *PNODE_SLOTS; // PNODE_SLOTS is a pointer to a NODE_SLOT This doesn't seem to work right. For starters, I've removed the uNumLinks field, so there are no more counters. I've decided to use a sentinal instead of a count field, because I only rarely need the number of links, and when I do, it's not a real-time requirement. Unfortunately, this setup gives me really screwy code. I'm tempted to throw this whole array thing out the window and just do something like typedef NODE ***PNODE_SLOTS; which is what I had way in the beginning. I guess my real question is: If I know something is a pointer to an array of pointers to an array of pointers to NODE's, can I treat them as a pointer to a pointer to a pointer to a NODE? -- Timur "too sexy for my code" Tabi, timur@vnet.ibm.com Architect, OS/2 Warp realtime MIDI subsystem http://timur.austin.ibm.com (internal IBM only) http://www.shirenet.com/~crusader/Timur (external)
Technical Details
Message-ID:
<4io1lf$ns1@solutions.solon.com>Path:
arc1-ca.pugleaf.net!solon.com!not-for-mailReferences:
<4i804b$46u@solutions.solon.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail From: timur@vnet.ibm.com (Timur Tabi) Newsgroups: comp.lang.c.moderated Subject: how do I typedef an array of pointers to a structure? Date: 19 Mar 1996 22:30:39 -0600 Organization: IBM Austin Sender: clc@solutions.solon.com Approved: clc@solutions.solon.com Message-ID: <4io1lf$ns1@solutions.solon.com> References: <4i804b$46u@solutions.solon.com> Reply-To: timur@vnet.ibm.com NNTP-Posting-Host: solutions.solon.com X-Newsreader: NeoLogic News for OS/2 [version: 4.5 YO Beta]