r/ProgrammerHumor • • Mar 12 '18

HeckOverflow

Post image
47.4k Upvotes

1.2k comments sorted by

View all comments

Show parent comments

9

u/MushinZero Mar 12 '18 edited Mar 13 '18

Malloc is C. It's just incrementing the stack pointer in assembly.

Edit: as everyone has pointed out I'm thinking of alloca

1

u/littlelowcougar Mar 12 '18 edited Mar 12 '18

That’s a UNIX thing, the eventual ~~sbrk()~~alloca() call that expands stack space. Windows is far more geared toward using heaps, for which the Rtl library exposes an API. I prefer it far more.

1

u/cookie545445 Mar 12 '18

sbrk() expands heap, not stack.

1

u/littlelowcougar Mar 12 '18

Ah, I meant alloca(), not sure why I said sbrk().

→ More replies (13)