Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!news.ecp.fr!nuzba.szn.dk!pnx.dk!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Ian Collins Newsgroups: comp.lang.c++ Subject: Re: Problem with array objects Date: Sun, 29 May 2011 08:21:45 +1200 Lines: 84 Message-ID: <94d3qqFr1qU5@mid.individual.net> References: <947tl0F9stU3@mid.individual.net> <948694Fmt0U1@mid.individual.net> <7EWDp.21826$m_1.16265@newsfe22.ams2> <8YadndAUkrEr233QnZ2dnUVZ8uKdnZ2d@giganews.com> <94b0pmFr1qU1@mid.individual.net> <36ZDp.7023$Tw4.2271@newsfe26.ams2> <94b8rkFr1qU2@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 zakB7PVforgyalEoRlKBNw0aW39rRiukrMIXDnbVke08IhR1yy Cancel-Lock: sha1:bNvPG2Fl1TJE/M83msTA/nyC/t8= 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++:5779 On 05/28/11 11:24 PM, Paul wrote: > > "Ian Collins" wrote in message > news:94b8rkFr1qU2@mid.individual.net... >> On 05/28/11 02:29 PM, Paul wrote: >>> >>> You are very quick to dismiss my opinion of what a pointer is in assembly >>> as >>> incorrect but what exactly is your opinion of what a pointer is? >> >> I was equally quick to dismiss the prediction that the world would end >> last weekend. >> >> A pointer in x86 assembly is simply a memory location or register that >> contains the address of another memory location. That's is not my >> opinion, it is what it is. > > No that is your opinion. > Other people have different opinions and I happen to be one of those people. I value the opinions of other professionals I have worked wit or known. So tell me, how many x86 assembly projects have you worked on? > I have already posted a link to Randal Hydes Art of Assembly that describes > what a pointer is, and RH defines that a pointer can be a simple offset. No, it does not. As usual you have chosen to misinterpret the link you have posted. > Here is another link that shows some other peoples opinions: > http://stackoverflow.com/questions/5055619/pointers-seen-on-assembly-or-registries So these are trusted sources? If so answer two is the same as mine, answer one is specific to PIC and answer 3 is a little vague, but contains the key phrase "with a width appropriate for the addressable size of the memory segment". So a pointer could be say 1000H, which could be used to address location 1000H with an immediate access, or loaded to a register as indirect access. This is analogous to writing char c = (char*)0x1000; in C++. >> The pointers in your example are esp (the stack pointer) and ebp (the base >> pointer). > > These are hardware registers. Correct, look at their names again. >> The instruction >> >> mov DWORD PTR _arr$[ebp], 0 >> >> given the definition of the constant _arr$ >> >> _arr$ = -12 ; size = 12 >> >> writes zero the the memory location who's address is ebp-12. Here ebp is >> the pointer and -12 is the offset. > > _arr$ is a label that equates to the value of (-12) . That is what I said. > Here the label _arr$ is used as a pointer, No it is used as an offer to a pointer. >> The next assignment which is a bit messy in MASM, >> >> mov DWORD PTR _arr$[ebp+4], eax >> >> writes zero the the memory location who's address is ebp-12+4. > > This confirms that _arr$ is an offset, which is used to create a memory > address. Therefore it's a pointer. No it isn't. It's no more a pointer than the 1 in *(p+1) = 0; No tell me again, how many x86 assembly projects have you worked on? -- Ian Collins