Re: array of pfDCS

New Message Reply Date view Thread view Subject view Author view

Scott McMillan (scott++at++ht.com)
Wed, 2 Jul 1997 10:12:32 -0400 (EDT)


>
>
> Hi -
>
> I'm trying to declare an array of pfDCS's. I tried:
>
> pfDCS dcsArray[4];
>
> and get the error: "storage size for 'dcsArray' isn't known"
>
> if I try:
>
> pfDCS *dcsArray;
> dcsArray = (pfDCS*) pfCalloc(4, sizeof(pfDCS), NULL );
>
> I get the error:
>
> "Reference of an expression of void type or an incomplete type."
>
> I think I have all the proper include files and compilation links. What
> am I doing wrong?
>
> Ryan McKinley

The man page states: "...like other pfNodes, pfDCSes are always allocated
from shared memory and cannot be created statically, on the stack or in
arrays." I am positive you are running into this in the first case and
assume so in the second case too. The following code dynamically allocates
an array of pfDCS pointers (optionally from the shared arena), and then it
loops through and dynamically allocates each pfDCS (calling the constructor
to boot):

   pfDCS **dcsArray;
   dcsArray = new(pfGetSharedShared()) pfDCS *[4];
   for (int i=0; i<4; i++)
      dcsArray[i] = new pfDCS();

-- 
  Scott McMillan  |    HT Medical, Inc.   | Developing medical VE's
   scott++at++ht.com   |   http://www.ht.com   | surgical simulations
 Ph: 301-984-3706 |6001 Montrose Rd., #902| and surgery simulation
Fax: 301-984-2104 |  Rockville, MD 20852  | creation tools.

======================================================================= List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/ Submissions: info-performer++at++sgi.com Admin. requests: info-performer-request++at++sgi.com


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:55:34 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.