POV-Ray : Newsgroups : povray.programming : void pointer array problem : Re: void pointer array problem Server Time
28 Jul 2024 08:22:25 EDT (-0400)
  Re: void pointer array problem  
From: Warp
Date: 2 Jul 2002 16:56:31
Message: <3d22137e@news.povray.org>
Thorsten Froehlich <tho### [at] trfde> wrote:
> The proper way is to inherit everything array can hold from a common
> base class and let array point to those.

  Yes, that's the right way of doing it. This is one thing where Java
*forces* you to make good code: There is no void*, but you must use
inheritance instead in order to achieve this.

  Also, I'm not sure if the ISO-C++ standard guarantees that a
pointer-to-class will always have the same size as void*.
  If the standard does not guarantee this, then theoretically storing
a pointer-to-class into a void* may lead to non-portable code (even though
every single C++ compiler I know uses regular pointers for classes as well,
so this is just very theoretical).

-- 
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}//  - Warp -


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.