Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > pointer to array types

Reply
Thread Tools

pointer to array types

 
 
Fred Zwarts
Guest
Posts: n/a
 
      03-23-2011

"Paul" <(E-Mail Removed)> wrote in message
news:826ip.79934$(E-Mail Removed)2...
>
> "Fred Zwarts" <(E-Mail Removed)> wrote in message
> news:imaitg$ei$(E-Mail Removed)...
>
>>>>> If you use the union as a float the memory location does not contain
>>>>> an array.
>>>>>
>>>>> --According to your reasoning,
>>>>> --IntPointer would be also a pointer to a float,
>>>>> --and to a float array, etc. etc.
>>>>>
>>>>> No, when the union chnages to represent a new data-type the pointer to
>>>>> the old data-type is no longer valid IMO.
>>>>
>>>>Your confusion leads you to wrong conclusions.
>>>>The pointer can still be used to assign an int value to x.Integer.
>>>>*IntPointer = 3;
>>>>So, it remains a valid pointer to int, even if the object at the memory
>>>>location is a float.
>>>>
>>> I'm not confused at all by your scenraio.

>>
>> --That is right. Your wrong conclusion does not come from my scenario,
>> --but from your ideas about pointers that are incompatible with the C++
>> --language.
>>
>> If you think p does not point to an array then I think you'll find that
>> it's you who is wrong.
>>
>> int*p = new int[3];

>
> --If you think that the pointer to the old data-type is no longer valid,
> --it is you who is wrong.
> --*IntPointer = 3;
>
> I didn't say the pointer was invalid. I said the pointer points-to the
> union no matter what type the pointer was.
> And you have just proved this is correct.
>


First Paul said (See above):
>>>>> No, when the union chnages to represent a new data-type the pointer to
>>>>> the old data-type is no longer valid IMO.


Now Paul summarizes:
> I didn't say the pointer was invalid.


Sorry, I'm unable to find the logic in this language.
If "no longer valid" is the same as "not invalid", anything can be true.
This makes it impossible for me to help him any further.

 
Reply With Quote
 
 
 
 
Paul
Guest
Posts: n/a
 
      03-23-2011

"Fred Zwarts" <(E-Mail Removed)> wrote in message
news:imcbim$6mu$(E-Mail Removed)...

"Paul" <(E-Mail Removed)> wrote in message
news:826ip.79934$(E-Mail Removed)2...
>
> "Fred Zwarts" <(E-Mail Removed)> wrote in message
> news:imaitg$ei$(E-Mail Removed)...
>
>>>>> If you use the union as a float the memory location does not contain
>>>>> an array.
>>>>>
>>>>> --According to your reasoning,
>>>>> --IntPointer would be also a pointer to a float,
>>>>> --and to a float array, etc. etc.
>>>>>
>>>>> No, when the union chnages to represent a new data-type the pointer to
>>>>> the old data-type is no longer valid IMO.
>>>>
>>>>Your confusion leads you to wrong conclusions.
>>>>The pointer can still be used to assign an int value to x.Integer.
>>>>*IntPointer = 3;
>>>>So, it remains a valid pointer to int, even if the object at the memory
>>>>location is a float.
>>>>
>>> I'm not confused at all by your scenraio.

>>
>> --That is right. Your wrong conclusion does not come from my scenario,
>> --but from your ideas about pointers that are incompatible with the C++
>> --language.
>>
>> If you think p does not point to an array then I think you'll find that
>> it's you who is wrong.
>>
>> int*p = new int[3];

>
> --If you think that the pointer to the old data-type is no longer valid,
> --it is you who is wrong.
> --*IntPointer = 3;
>
> I didn't say the pointer was invalid. I said the pointer points-to the
> union no matter what type the pointer was.
> And you have just proved this is correct.
>


--First Paul said (See above):
>>>>> No, when the union chnages to represent a new data-type the pointer to
>>>>> the old data-type is no longer valid IMO.


--Now Paul summarizes:
> I didn't say the pointer was invalid.


I was obviously talking about using a pointer to access data of the old
data-type.


--Sorry, I'm unable to find the logic in this language.
--If "no longer valid" is the same as "not invalid", anything can be true.
--This makes it impossible for me to help him any further.

Good I don't need nor do I wnat your help TYVM, Goodbye and GL
..


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
pointer to an array vs pointer to pointer subramanian100in@yahoo.com, India C Programming 5 09-23-2011 10:28 AM
Pointer to array of array of const pointer RSL C++ 14 02-19-2010 02:06 PM
Array of pointer and pointer of array erfan C Programming 6 01-28-2008 08:55 PM
Casting from pointer types to non-pointer types jois.de.vivre@gmail.com C++ 11 06-07-2007 09:17 AM
Array of pointer Vs Pointer to Array sangeetha C Programming 9 10-09-2004 07:01 PM



Advertisments