POV-Ray : Newsgroups : povray.off-topic : 99 lines of C++ for an unbiased ray tracer : Re: 99 lines of C++ for an unbiased ray tracer Server Time
4 Sep 2024 23:24:31 EDT (-0400)
  Re: 99 lines of C++ for an unbiased ray tracer  
From: Warp
Date: 15 Jan 2010 07:00:28
Message: <4b5058db@news.povray.org>
Darren New <dne### [at] sanrrcom> wrote:
> Well, no, I disagree. How do you find the size of an array at runtime? 

  It's a constant integral value, hence known at runtime.

> That's exactly why you have to pass it around along with the pointer.

  Now you are confusing dynamically allocated arrays with static arrays.
They are not the same thing.

  The size of dynamically allocated arrays cannot be resolved either at
runtime nor at compile time (eg. you cannot use the size of a dynamically
allocated array somewhere where a compile-time constant is expected).

> Hmmm... If you put an array in a struct, can you ask 
> "sizeof(myrecord.thearray)" and get an appropriate size?

  Yes, actually.

> I suppose you 
> could, but still I wouldn't count that as such.

  "As such"? What? Runtime? sizeof() always works at compile time.

-- 
                                                          - Warp


Post a reply to this message

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