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
5 Sep 2024 01:25:56 EDT (-0400)
  Re: 99 lines of C++ for an unbiased ray tracer  
From: Orchid XP v8
Date: 14 Jan 2010 16:41:40
Message: <4b4f8f94@news.povray.org>
>>>   Since sizeof() of an array returns the total amount of bytes taken by
>>> an array, if you divide it by the amount of bytes of one element, you get
>>> the total number of elements.
> 
>> This is plain. What surprises me is that sizeof() can give you an 
>> accurate size in the first place.
> 
>   Why wouldn't it? The compiler has to know the size of the array if it
> wants to allocate it in memory.

All that stuff about "C does not know the size of an array at run-time, 
and does not check array bounds". But then, this is from the same books 
that claim that pointers *are* arrays... Certainly if you asked for 
sizeof() on a pointer, you wouldn't get the size of the array it points to.

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

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