bugProgramming from the Ground Up Book - Bugs: bug #24791, Page 91 - ver 1.0 (book size) -...


bug #24791: Page 91 - ver 1.0 (book size) - values for command-line argument positions given relative to %esp - better from %ebp

Submitted by:  John Graham <johngraham>
Submitted on:  Sun 09 Nov 2008 03:16:24 PM UTC  
Votes:  1  
Category:  None Severity:  3 - Normal
Item Group:  None Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Mon 07 Dec 2009 10:43:23 PM UTC, comment #1: 

I was tricked by this description, exactly the same way, too.

Polat Tuzla <ptuzla>
Sun 09 Nov 2008 03:16:24 PM UTC, original submission:  

Page 91 of the book states that:

"The number of arguments is stored at 8(%esp), the name of the
program is stored at 12(%esp), and the arguments are stored from 16(%esp) on."

Which is correct, but only because this program reserves space for local variables.  However, it's very easy for someone (especially a beginner - I did!) to read this as being true all the time, which it's not.

It makes a lot more sense to refer to the number of arguments being at 0(%ebp), the name stored at 4(%ebp) and pointers to the arguments starting from at 8(%ebp).  Also, the arguments are referred to this way in the program itself.

John Graham <johngraham>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by ptuzla (Voted in favor of this item)
  • -email is unavailable- added by ptuzla (Posted a comment)
  • -email is unavailable- added by johngraham (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 1 encouragement so far.

    Only logged-in users can vote.




    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2009-12-07 ptuzla Carbon-Copy- => Added ptuzla

    Back to the top

    Powered by Savane 3.6