Group: comp.lang.c++
From: "Alf P. Steinbach"
Date: Friday, February 15, 2008 2:15 PM
Subject: Re: char * memory leak

* Default User:
> Alf P. Steinbach wrote:
>
>> * Default User:
>>> Alf P. Steinbach wrote:
>>>
>>>> * Default User:
>>>>> Alf P. Steinbach wrote:
>>>>>
>>>>>> * Travis:
>>>>>>> Quick question, how is a char * different than any other
>>>>>>> pointer? I've never had this really elaborated.
>>>>>> That's not a quick question.
>>>>>>
>>>>>> 'char' is the smallest addressable unit of memory in C and
>>>>>> C++.
>>>>>>
>>>>>> First, this means a char* pointer may on some architectures
>>>>>> need to be larger than other data pointers (excluding member
>>>>>> data pointers), and in effect it probably determines the size
>>>>>> of void*, which must be large enough for any data pointer.
>>>>> Not probably.
>>>> Well I fail to find any hard information on what determines what.
>>>>
>>>> If you have, then that would be nice. Do you?
>>> The reasoning was that which followed in my next paragraph of my
>>> previous message. The requirement is that void* have the
>>> representation of char*, so it is char* that is the determining
>>> factor. Do you feel that is not the case?
>> It's not a valid inference.
>
> I disagree (obviously).

Validity of logical inference isn't open to agreement or disagreement.

Logic is not a matter of feeling.


>> First, "same as" is not a one-way
>> correspondence: it works both ways, so that your reasoning would work
>> just as well for the opposite conclusion. Second, since void* must
>> accomodate all data pointers, there is more involved.
>
> If they wanted that, they could have said, "void* and char* shall have
> the same representation". They very specifically said that void* is the
> same a char*.

If "they" didn't want that paragraph to mean "Pascal is really better",
then "they" wouldn't have used that blindingly-obvious code phrase
"cv-qualified or cv-unqualified", but simply said nothing about that.
So it's obvious that the sentence means "Pascal is really better".


> As others have pointed out, there may be other factors driving char*
> requirements. void* has to pick those up.

I think you mean me, not "others".


Perplexed,

- Alf

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?

Safety Articles | Usenet Groups | Usenet News | Bluegrass