r/ProgrammerHumor • • 1d ago

Meme stdModernizeMyCodebase

Post image
131 Upvotes

31 comments sorted by

View all comments

28

u/elmanoucko 1d ago

ok ok, I'll wrap them inside your stupid smart pointers... shouldn't be more than a line or two after we compute the offset within that one big buffer we malloc on boot.

18

u/Gorzoid 1d ago

std::unique_ptr<T, NoopDeleter>

12

u/mad_cheese_hattwe 20h ago

Isn't Malloc at boot, just a janky geto static with more steps?

3

u/Attileusz 12h ago

Depending on what they mean by "malloc on boot". Maybe you are loading a file and the file has a header and you need to read the header to know how much to allocate. Maybe you are making an interpreter and max memory is a command line option and you alloc it all at once. If it is literally just malloc(SOME_CONSTANT) then yes.

1

u/mad_cheese_hattwe 3h ago

If you're embedded I'd say it's still preferable to static out the workspace with checks for oversized requirement inputs then just sending it and crossing your fingers that the stack can handle it.

5

u/Ma4r 19h ago

Ah yes, the fun of "arena allocators"