explain_strtold_or_die(3)
π explain_strtold_or_die(3) π
okay bestie, gather round, because this one is a Library Functions Manual page and it is genuinely so useful it's not even funny. it's called explain_strtold_or_die, and it lives in the libexplain cinematic universe. π
β¨ NAME β¨
explain_strtold_or_die β convert string to number and report errors
π SYNOPSIS π
#include <libexplain/strtold.h>
long double explain_strtold_or_die(const char *nptr, char **endptr);
long double explain_strtold_on_error(const char *nptr, char **endptr))
yes bb, that is two closing parens on the second line. that's literally what the page says, so that's literally what we're keeping. iykyk. π
πΈ DESCRIPTION πΈ
so here's the vibe. there are two little functions here and they're basically sisters, one is just a lil more dramatic than the other.
explain_strtold_or_dieβ this one is used to call thestrtold(3)system call. and if it fails? an explanation gets printed tostderr, obtained from theexplain_strtold(3)function, and then the process terminates by callingexit(EXIT_FAILURE). it's giving main character energy, honestly. it does not come back. πexplain_strtold_on_errorβ same deal, it's used to call thestrtold(3)system call, and on failure an explanation is printed tostderr, obtained from theexplain_strtold(3)functionβ¦ but this one still returns to the caller. chillest of the two. no exit, no drama. π«Ά
and the arguments, bestie, they are literally just passed straight through:
nptrβ thenptr, exactly as to be passed to thestrtold(3)system call.endptrβ theendptr, exactly as to be passed to thestrtold(3)system call.
like. no notes. it hands them over untouched. periodt. β¨
π RETURN VALUE π
explain_strtold_or_dieonly returns on success. want more info on that? seestrtold(3). on failure, it prints an explanation and exits β it does not return. nope. not happening. not ever. πexplain_strtold_on_erroralways returns the value return by the wrappedstrtold(3)system call. (yes, "return", not "returned" β we're keeping it exactly as written, don't look at me π)
π¦ EXAMPLE π¦
the explain_strtold_or_die function is intended to be used in a fashion similar to the following example:
long double result = explain_strtold_or_die(nptr, endptr);
one line. one call. iconic behaviour. β
π SEE ALSO π
strtold(3)β convert ASCII string to floatingβpoint numberexplain_strtold(3)β explainstrtold(3)errorsexit(2)β terminate the calling process
π COPYRIGHT π
libexplain version 1.4 Copyright (C) 2009 Peter Miller
and that's the whole page, bestie!! π§β¨ this was explain_strtold_or_die(3) from the Library Functions Manual, brought to you by libexplain version 1.4, with Copyright (C) 2009 Peter Miller holding it down at the bottom. go forth and convert your strings, and remember: one of these functions will absolutely exit on you and it is not sorry about it. πππ¦
π¦ where this page comes from
- debian bookworm: libexplain-dev 1.4.D001-12+b1 Β· LGPL-3.0-or-later
- debian trixie: libexplain-dev 1.4.D001-16 Β· LGPL-3.0-or-later
- ubuntu jammy: libexplain-dev 1.4.D001-12 Β· LGPL-3.0-or-later
- ubuntu noble: libexplain-dev 1.4.D001-13 Β· LGPL-3.0-or-later
- ubuntu resolute: libexplain-dev 1.4.D001-16 Β· LGPL-3.0-or-later
- Copyright (C) 2009-2011 Peter Miller
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms