Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!news.musoftware.de!wum.musoftware.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Ian Collins Newsgroups: comp.lang.c++ Subject: Re: Lets put it another way Date: Wed, 25 May 2011 07:36:31 +1200 Lines: 86 Message-ID: <942fm0Fuc5U1@mid.individual.net> References: <940g82Ft2pU20@mid.individual.net> <941ffpFt2pU22@mid.individual.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net q+D5Ivcov2fcL/jfA2YaGwc5eVrtTTGm40nBcmK04bdURwlJR3 Cancel-Lock: sha1:L0LKJ5iTaUgH7FxoIikYab/Kf7A= User-Agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:1.9.2.9) Gecko/20101021 Lightning/1.0b2 Thunderbird/3.1.4 In-Reply-To: Xref: x330-a1.tempe.blueboxinc.net comp.lang.c++:5444 On 05/25/11 12:58 AM, Paul wrote: > > "Ian Collins" wrote in message > news:941ffpFt2pU22@mid.individual.net... >> On 05/24/11 09:20 PM, Paul wrote: >>> >>> "Ian Collins" 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 >>>>> >>>>> typedef int (*pparr)[3]; >>>>> >>>>> int main(){ >>>>> pparr p1 = (pparr)new int[3]; >>>>> pparr p2= p1; >>>>> delete[] p1; >>>>> std::cout<< *p2<>>> >>>> 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 >> #include >> >> 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