News for hackers. Stuff that matters.
Re:Your code should be taken out back, lined up against a wa... by lallysingh on Tuesday July 27, 2010 @02:42PM (#1552234)
The asm statement puts the pointer (the malloc(5000)+5000's result) into the stack pointer. When the arguments are passed into fprintf(), they're pushed on top of that frame (presumably back into the malloc'd block).

In my book, a worthy attempt to grow your stack on the heap, but you've really got to be ready to hit the asm debugger when things go awry.

Edit: as mentioned in other comments, the mistake was (at least) in not restoring the stack pointer before main returned.

There are no comments on this comment yet.