Re: calling constructor when allocating an array
Ron Natalie wrote:[color=blue][color=green][color=darkred]
>>>> This is not a pointer array. It is a pointer to an array.
>>>
>>> Well it's a pointer to the first element of an array.[/color]
>>
>> Yes. This is the way it goes when we point to a part of the memory.
>> We
>> point to the beginning of it. Like a pointer to a double will point
>> to its
>> first byte. ;-)
>>[/color]
> No, pointers point to complete objects as far as the language is
> concerend.
> MyClass* points to one MyClass instance which happens to be the first
> element of the array.[/color]
SET PEDANTIC=OFF
In any case: a pointer array (as far as I know English) is an array of
pointers. I do not feel my description too misleading. It might not be
pedantic to call it a pointer to an array but it does point to an array of
MyClass instances.
I understand that (strictly speaking) if I say pointer to an array one might
say: OK, so if I then say ++ptr, then it will point to the next array. And
of course this is not the case. :-)
--
WW aka Attila
Ron Natalie wrote:[color=blue][color=green][color=darkred]
>>>> This is not a pointer array. It is a pointer to an array.
>>>
>>> Well it's a pointer to the first element of an array.[/color]
>>
>> Yes. This is the way it goes when we point to a part of the memory.
>> We
>> point to the beginning of it. Like a pointer to a double will point
>> to its
>> first byte. ;-)
>>[/color]
> No, pointers point to complete objects as far as the language is
> concerend.
> MyClass* points to one MyClass instance which happens to be the first
> element of the array.[/color]
SET PEDANTIC=OFF
In any case: a pointer array (as far as I know English) is an array of
pointers. I do not feel my description too misleading. It might not be
pedantic to call it a pointer to an array but it does point to an array of
MyClass instances.
I understand that (strictly speaking) if I say pointer to an array one might
say: OK, so if I then say ++ptr, then it will point to the next array. And
of course this is not the case. :-)
--
WW aka Attila
Comment