Hacker News new | ask | show | jobs
by floating-io 328 days ago
Not sure offhand how portable it is, but asprintf() handles automatic buffer allocation, thus not requiring any extra steps afaik.

It does exit on MacOS and Linux, at the very least.

1 comments

Those are so unportable that I’d completely forgotten about them :)

But my man pages say that they exist on BSD in addition to GNU, so that’s pretty good these days. I say go for it.