Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #5444

Re: Lets put it another way

From Ian Collins <ian-news@hotmail.com>
Newsgroups comp.lang.c++
Subject Re: Lets put it another way
Date 2011-05-25 07:36 +1200
Message-ID <942fm0Fuc5U1@mid.individual.net> (permalink)
References <bEDCp.16705$Am5.10787@newsfe05.ams2> <940g82Ft2pU20@mid.individual.net> <FLKCp.6980$Ky.4690@newsfe24.ams2> <941ffpFt2pU22@mid.individual.net> <aYNCp.9364$2E6.4304@newsfe18.ams2>

Show all headers | View raw


On 05/25/11 12:58 AM, Paul wrote:
>
> "Ian Collins"<ian-news@hotmail.com>  wrote in message
> news:941ffpFt2pU22@mid.individual.net...
>> On 05/24/11 09:20 PM, Paul wrote:
>>>
>>> "Ian Collins"<ian-news@hotmail.com>   wrote in message
>>> news:940g82Ft2pU20@mid.individual.net...
>>>> On 05/24/11 01:14 PM, Paul wrote:
>>>>> Ok in connection to my previous post, lets remove the null pointer
>>>>> issue
>>>>> and
>>>>> consider this:
>>>>>
>>>>> #include<iostream>
>>>>>
>>>>> typedef int (*pparr)[3];
>>>>>
>>>>> int main(){
>>>>>     pparr p1 = (pparr)new int[3];
>>>>>     pparr p2= p1;
>>>>>     delete[] p1;
>>>>>     std::cout<<    *p2<<std::endl;
>>>>
>>>> UB yet again.
>>>>
>>>>>     std::cout<<    typeid(*p2).name();
>>>>> }
>>>>>
>>>>>
>>>>> In the last 2 lines does an array type object exist, even though there
>>>>> is
>>>>> no
>>>>> array object?
>>>>
>>>> No.
>>>>
>>>>> If not what is the object that stores the address and is interpreted as
>>>>> an
>>>>> array type by the typeid expression?
>>>>
>>>> The typeid and sizeof operators do not evaluate their expression (unless
>>>> in case of typeid the type is polymorphic).  So no object is required.
>>>>
>>> You do not seem to understand the question.
>>
>> You do not appear to understand the answer.
>>
>>> I said ..if not what is the object that stores the address?
>>> So what is this object? Do you know?
>>
>> There isn't an object.  The compiler knows the type of *p2.  You may as
>> well have written
>>
>> #include<iostream>
>> #include<typeinfo>
>>
>> typedef int (*pparr)[3];
>>
>> int main(){
>>    pparr p2;
>>    std::cout<<  typeid(*p2).name()<<  std::endl;
>> }
>>
>>
> You are not addressing the what stores the memory address.

Because there isn't an address to store.  The typeid operator (like 
sizeof) works with types, not values.  In a simple case such as this the 
operand is not evaluated.  Until you understand this you will be stuck 
in limbo.

I could have simplified my simplification further by writing

std::cout << typeid(int[3]).name() << std::endl;

See?  No memory address just a type.

> A memory address value is stored so there must be an object to store this
> value, you say there is no object so what is it that stores this value?

There isn't an address.  Where's the address in typeid(int).name()?  Or 
sizeof(int)?

-- 
Ian Collins

Back to comp.lang.c++ | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Lets put it another way "Paul" <pchristor@yahoo.co.uk> - 2011-05-24 02:14 +0100
  Re: Lets put it another way Ian Collins <ian-news@hotmail.com> - 2011-05-24 13:33 +1200
    Re: Lets put it another way Joshua Maurice <joshuamaurice@gmail.com> - 2011-05-23 18:39 -0700
      Re: Lets put it another way "Paul" <pchristor@yahoo.co.uk> - 2011-05-24 10:42 +0100
        Re: Lets put it another way Joshua Maurice <joshuamaurice@gmail.com> - 2011-05-24 03:00 -0700
          Re: Lets put it another way Joshua Maurice <joshuamaurice@gmail.com> - 2011-05-24 03:03 -0700
            Re: Lets put it another way "Paul" <pchristor@yahoo.co.uk> - 2011-05-24 14:54 +0100
              Re: Lets put it another way Joshua Maurice <joshuamaurice@gmail.com> - 2011-05-24 13:46 -0700
                Re: Lets put it another way Leigh Johnston <leigh@i42.co.uk> - 2011-05-24 21:49 +0100
                Re: Lets put it another way "Paul" <pchristor@yahoo.co.uk> - 2011-05-24 23:56 +0100
                Re: Lets put it another way Joshua Maurice <joshuamaurice@gmail.com> - 2011-05-24 16:51 -0700
                Re: Lets put it another way "Paul" <pchristor@yahoo.co.uk> - 2011-05-25 10:59 +0100
                Re: Lets put it another way Joshua Maurice <joshuamaurice@gmail.com> - 2011-05-25 03:51 -0700
                Re: Lets put it another way "Paul" <pchristor@yahoo.co.uk> - 2011-05-25 12:49 +0100
                Re: Lets put it another way "Joel C. Salomon" <joelcsalomon@gmail.com> - 2011-05-25 12:32 -0700
                Re: Lets put it another way Joshua Maurice <joshuamaurice@gmail.com> - 2011-05-25 13:42 -0700
                Re: Lets put it another way Joshua Maurice <joshuamaurice@gmail.com> - 2011-05-25 13:48 -0700
                Re: Lets put it another way "Paul" <pchristor@yahoo.co.uk> - 2011-05-25 21:55 +0100
                Re: Lets put it another way Joshua Maurice <joshuamaurice@gmail.com> - 2011-05-25 13:59 -0700
                Re: Lets put it another way "Paul" <pchristor@yahoo.co.uk> - 2011-05-25 22:08 +0100
                Re: Lets put it another way Joshua Maurice <joshuamaurice@gmail.com> - 2011-05-25 14:29 -0700
                Re: Lets put it another way "Paul" <pchristor@yahoo.co.uk> - 2011-05-25 22:56 +0100
                Re: Lets put it another way Joshua Maurice <joshuamaurice@gmail.com> - 2011-05-25 15:10 -0700
                Re: Lets put it another way "Paul" <pchristor@yahoo.co.uk> - 2011-05-25 23:53 +0100
                Re: Lets put it another way "Joel C. Salomon" <joelcsalomon@gmail.com> - 2011-05-25 15:02 -0700
                Re: Lets put it another way "Paul" <pchristor@yahoo.co.uk> - 2011-05-25 23:37 +0100
                Re: Lets put it another way Joshua Maurice <joshuamaurice@gmail.com> - 2011-05-25 16:03 -0700
                Re: Lets put it another way "Paul" <pchristor@yahoo.co.uk> - 2011-05-26 00:19 +0100
                Re: Lets put it another way Leigh Johnston <leigh@i42.co.uk> - 2011-05-26 00:29 +0100
                Re: Lets put it another way Joshua Maurice <joshuamaurice@gmail.com> - 2011-05-25 16:30 -0700
                Re: Lets put it another way "Paul" <pchristor@yahoo.co.uk> - 2011-05-26 00:58 +0100
                Re: Lets put it another way Joshua Maurice <joshuamaurice@gmail.com> - 2011-05-25 17:10 -0700
                Re: Lets put it another way "Paul" <pchristor@yahoo.co.uk> - 2011-05-26 01:26 +0100
                Re: Lets put it another way Joshua Maurice <joshuamaurice@gmail.com> - 2011-05-25 17:54 -0700
                Re: Lets put it another way "Paul" <pchristor@yahoo.co.uk> - 2011-05-26 10:42 +0100
                Re: Lets put it another way Joshua Maurice <joshuamaurice@gmail.com> - 2011-05-26 03:06 -0700
                Re: Lets put it another way "Paul" <pchristor@yahoo.co.uk> - 2011-05-26 11:25 +0100
                Re: Lets put it another way Joshua Maurice <joshuamaurice@gmail.com> - 2011-05-26 03:33 -0700
                Re: Lets put it another way "Paul" <pchristor@yahoo.co.uk> - 2011-05-26 12:56 +0100
                Re: Lets put it another way Vidar Hasfjord <vattilah-groups@yahoo.co.uk> - 2011-05-25 16:09 -0700
                Re: Lets put it another way "Paul" <pchristor@yahoo.co.uk> - 2011-05-26 00:20 +0100
                Re: Lets put it another way "Joel C. Salomon" <joelcsalomon@gmail.com> - 2011-05-25 13:56 -0700
                Re: Lets put it another way "Paul" <pchristor@yahoo.co.uk> - 2011-05-25 22:18 +0100
                Re: Lets put it another way "Paul" <pchristor@yahoo.co.uk> - 2011-05-25 12:45 +0100
                Re: Lets put it another way Joshua Maurice <joshuamaurice@gmail.com> - 2011-05-25 13:47 -0700
                Re: Lets put it another way "Paul" <pchristor@yahoo.co.uk> - 2011-05-25 22:03 +0100
          Re: Lets put it another way "Paul" <pchristor@yahoo.co.uk> - 2011-05-24 14:32 +0100
            Re: Lets put it another way Joshua Maurice <joshuamaurice@gmail.com> - 2011-05-24 14:16 -0700
              Re: Lets put it another way "Paul" <pchristor@yahoo.co.uk> - 2011-05-25 00:00 +0100
    Re: Lets put it another way "Paul" <pchristor@yahoo.co.uk> - 2011-05-24 10:20 +0100
      Re: Lets put it another way Ian Collins <ian-news@hotmail.com> - 2011-05-24 22:27 +1200
        Re: Lets put it another way "Paul" <pchristor@yahoo.co.uk> - 2011-05-24 13:58 +0100
          Re: Lets put it another way Ian Collins <ian-news@hotmail.com> - 2011-05-25 07:36 +1200
            Re: Lets put it another way "Paul" <pchristor@yahoo.co.uk> - 2011-05-24 21:11 +0100
              Re: Lets put it another way Oliver Jackson <chexmofo@hotmail.com> - 2011-05-24 16:04 -0700
                Re: Lets put it another way "Paul" <pchristor@yahoo.co.uk> - 2011-05-26 11:27 +0100
              Re: Lets put it another way Ian Collins <ian-news@hotmail.com> - 2011-05-25 12:03 +1200
                Re: Lets put it another way "Paul" <pchristor@yahoo.co.uk> - 2011-05-25 11:13 +0100
                Re: Lets put it another way Ian Collins <ian-news@hotmail.com> - 2011-05-26 09:19 +1200
                Re: Lets put it another way "Paul" <pchristor@yahoo.co.uk> - 2011-05-25 22:39 +0100
                Re: Lets put it another way Joshua Maurice <joshuamaurice@gmail.com> - 2011-05-25 14:45 -0700
                Re: Lets put it another way "Paul" <pchristor@yahoo.co.uk> - 2011-05-25 23:01 +0100
                Re: Lets put it another way Leigh Johnston <leigh@i42.co.uk> - 2011-05-25 22:48 +0100
                Re: Lets put it another way Ian Collins <ian-news@hotmail.com> - 2011-05-26 09:57 +1200
                Re: Lets put it another way "Paul" <pchristor@yahoo.co.uk> - 2011-05-25 23:09 +0100
                Re: Lets put it another way Ian Collins <ian-news@hotmail.com> - 2011-05-26 10:17 +1200
                Re: Lets put it another way "Paul" <pchristor@yahoo.co.uk> - 2011-05-25 23:56 +0100
                Re: Lets put it another way Ian Collins <ian-news@hotmail.com> - 2011-05-26 13:04 +1200
                Re: Lets put it another way "Paul" <pchristor@yahoo.co.uk> - 2011-05-26 10:47 +0100
                Re: Lets put it another way Joshua Maurice <joshuamaurice@gmail.com> - 2011-05-25 15:17 -0700
                Re: Lets put it another way "Paul" <pchristor@yahoo.co.uk> - 2011-05-26 00:03 +0100
                Re: Lets put it another way Joshua Maurice <joshuamaurice@gmail.com> - 2011-05-25 16:14 -0700
                Re: Lets put it another way "Paul" <pchristor@yahoo.co.uk> - 2011-05-26 00:32 +0100
                Re: Lets put it another way Joshua Maurice <joshuamaurice@gmail.com> - 2011-05-25 16:39 -0700
                Re: Lets put it another way "Paul" <pchristor@yahoo.co.uk> - 2011-05-26 01:18 +0100
                Re: Lets put it another way Joshua Maurice <joshuamaurice@gmail.com> - 2011-05-25 17:52 -0700
                Re: Lets put it another way "Paul" <pchristor@yahoo.co.uk> - 2011-05-26 10:53 +0100
  Re: Lets put it another way Vidar Hasfjord <vattilah-groups@yahoo.co.uk> - 2011-05-25 15:31 -0700
    Re: Lets put it another way "Paul" <pchristor@yahoo.co.uk> - 2011-05-25 23:58 +0100
      Re: Lets put it another way Vidar Hasfjord <vattilah-groups@yahoo.co.uk> - 2011-05-25 16:54 -0700
        Re: Lets put it another way "Paul" <pchristor@yahoo.co.uk> - 2011-05-26 01:00 +0100

csiph-web