Get the latest tech news

Smart Pointers in (GNU) C


I am a big fan of C, but some part of me always yearn to have just enough higher level constructs.

Being very easily distracted, I tend to forget to free my memory, or close my resources, so you might guess that when I learned about smart pointers in C++, I was immediately hooked. This means that for any type managed by smalloc I could just call sfree on it without worrying about the real destructor function, and I would know that it would have been destroyed – this was a huge improvement. I also took the time to add a way to put user-defined data into the metadata block, since it could have some nice applications, like length-aware arrays, or extending existing library structures.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of GNU

GNU

Photo of Smart Pointers

Smart Pointers

Related news:

News photo

Show HN: Making GNU Make a better Task Runner

News photo

GNU LibreJS: blocks JavaScript traps

News photo

Pruning some things out with (GNU) find options