|
|
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
|
|