die(3)

πŸ’… die(3) β€” bestie edition πŸŽ€

okay so you know how sometimes a program just needs to ✨ dramatically exit stage left ✨? that's this. it's from the Library Functions Manual, and it lives at die(3). it's giving main character energy, no cap.


🌸 NAME 🌸

die β€” print a warning diagnostic and then abort the program. like, the program is DONE. it's over. periodt.


✨ SYNTAX ✨

#include <libowfat/errmsg.h>

void die(int exitcode, const char *message, ...);

πŸ’– DESCRIPTION πŸ’–

okay so here's the tea πŸ“ β€” if errmsg_iam was called at some point to set the program name, then die will print that program name first, followed by a colon. like a little name tag before it drags the whole program.

then die prints all of its arguments to stderr (that's fd #2, bestie, the dramatic one πŸ’€) and after that it calls exit(exitcode).

🚨 important: it does not synchronize with any other output method. so if you've got other stuff writing to output, they're not talking to each other, they're just vibing in parallel and that's a problem.

so if you need that output to actually make it out the door first, you gotta flush buffer_1 and buffer_2 manually, yourself, before you call die. lowkey annoying but that's the deal 🫢


⭐ NOTE ⭐

this function does not return. nope. never. not once. it exits the program, so don't be out here writing code after it like it's coming back 😭 it's not coming back, bestie.


🌈 SEE ALSO 🌈


okay bye ily, this was die(3) from the Library Functions Manual β€” go forth and exit dramatically, you absolute icon πŸ‘‘πŸ’…βœ¨