On 11/30/2026 10:48 AM, Ross Finlayson wrote:
> On 11/30/2026 10:31 AM, Lawrence D’Oliveiro wrote:
>> On Sun, 29 Nov 2026 22:44:26 -0800, Andrey Tarasevich wrote: >>
>>> On Sun 11/29/2026 10:00 PM, Lawrence D’Oliveiro wrote:
>>>> >>>> On Linux systems, you can set the memory-allocation policy to >>>> “overcommit”, which basically means that, when a process asks for >>>> memory, the kernel never says no >>>> <https://manpages.debian.org/proc_sys_vm(5)>.
>>> >>> Well, firstly, overcommit approach simply substitutes "virtual >>> address space" in place of "actual memory" as the limited resource.
>> >> No, it is actual memory that is being overcommitted. >>
> > > If a wrapper is considered a good idea, then here there's that when > there are many calls, for example in a loop, for example that need > buffers, and to prevent them having fixed-length or variable-length > array buffers in their code, when for the hot body or inner routine > it's called of the loop where the instructions are to fit in the > code-cache and the buffers are to fit in the data-cache, makes for > an idea of "rolling" the buffers in a sense, not to be confusing > shift & rotate, and "rocking" the buffers in a sense, since "rock & > roll" isn't already an idiom within programming itself though it's > after the rhythm & blues an account of the often the simple the tempo, > is basically for an account of, for example, a loop-body that in the > scope of the loop, manages memory with regards to "fixed-length buffers > large enough for any of the uses in the loop", this sort of account > of the "glo-calls" then the "fixed-length arrays: sized and aligned > to cache-line/memory-page/memory-huge-page", then for formatters > usually enough (eg, integer to string or string to integer, with > making a default representation then a localized representation then > an aligned representation as separate concerns, since the cache is hot, > makes for a model of a little machine in its own little body of > definition, "rock & roll rotating-buffers and formatting-layers". > > >
About printf, the famous and sole facility in C, among the system library or standard functions available to C according to C then POSIX, has that it becomes its own little language and very terse then employing the var-args, is quite flexible, yet in the same account, rather rigid, which for example as for where gcc for quite some time, and I'm not aware since when, provides errors when formatting specifiers don't match the var-args type in the AST since then the var-args would forget them and rigidly for example corrupt the stack given wrong inputs, has that var-args is one of the worse boojums of safety in C, then that formatting strings is often enough the second, besides "off-by-one errors" which occur mostly anywhere due the 0-based and 1-based and whether the "end" is beyond the "index", that everybody knows and for example where -1 means "not-found" about size_t and ssize_t "signed size_t", for examples. So, implementing a "to_string" and "from_string" in C, or "to_str" and "fro_str", can be broken out into layers of its considerations, then for formatting and specifiers, like scale and precision and padding and radix and so on, about the "format string" usually enough "fmt", or "msgfmt", and, the variables to be interpolated into the string, building those then of to_str/fro_str, or tow_str/fro_str, currying those up quite broken out, so that then the ideal of the alias/stall/branch/call/fault-less, can work on rocking & rolling fixed length buffers, keeping the code fitting in the code-cache and data fitting in the data-cache, in the formatting-routine then the loop-body. So, the idea here about the representations, or string-representations or string-reps, is sort of like this: a stack of operations on a representation to result representations, then, about when to ultimately placeholder-substitute or interpolate those, into something that looks like the bog-standard sort of use of "{myvar}" for the expression in the substitution-placeholder, vis-a-vis, print's formatters and friends. int: first needs radix to determine the alphabet, might be negative so have a minus sign (or, an attribute) would have attributes about for example the radix then that's itself a sequence of digits, decimal / hexadecimal / octal / binary nobody uses radices other than that float: radix isn't relevant, it's decimal in the representation might be "Not-a-Number" it's signed, negative or non-negative scale and precision / mantissa and significand basically to be truncated to one of: significant-digits of "scientific numbers" fixed-length post-radix part (the radix means both the base and the decimal point), counting beans usually string: it's already a string, ... timespec / date-formats this basically involves usually exactly only one of them, then with many and various time-zones and date-formats that being considered after though the "first rep" itself Then, the idea is that what gets built of these, has all the relevant attributes, to first return a string (or, simply a struct containing the string and the attrs), this "first rep", then the "second rep", is about "locale" usually enough. So, that would involve date-formats and so on, and data-formats, like for ISO646 usually here yet for the "human-readable" gettings into accounts like locale and commas and periods or commas and stops as they're called, about modulus-separators (usually in groups of 3) and the radix-point (here always a period/stop, "billiard" isn't a number here, though it's a word in a language), then that the first rep has got what can make an unambiguous second rep, particularly when for accounts of usual data-formats, it's a no-op, and the first rep has a string, then the second rep has things like "0x" for hexadecimal or "0" for octal or "b" for binary for example besides things like as from the original type, they're literals their suffixes when for example "L, UL, LL, ULL, ...", common sorts representations. Then, whether that sort of account of "literals" should precede "localization", basically has that those are their own sort of "locale", like "source" or "natural". Then, later there's the padding & alignment, and alike for leading zeros for example, or when for example "blank means zero", about "empties & blanks & zero", when for example to write something like "[NULL]" for what was null, that suggests actually the earlier representation, then though that padding & alignment seems live in the format, and about that the format has to be parsed in a sense to have its expressions indicate anything, then about that advising what formatters get involved. int i = 1; float f = 1.0f; timespec ts = {0, 0}; printf("integer %d float %f seconds/subseconds %d/%d", i, f, ts); prfmt("integer {} float {} seconds/subseconds {}/{}", fro_str(i), fro_str(f), fro_str(ts)); Then, a usual idea would seem that fro_str doesn't return strings, instead it returns a representation & formatting context, then that prfmt, or if still using var-args, has they'd always be of a given type, so that instead, it's just broken out each of those fixed length, then with regards about how to overload functions according to signature-length instead of otherwise a controlling-expression, whether the compiler offers a built-in for parameter-count, and these kinds of things. So, then these varied accounts of representations their formatting, get broken out into separate responsibilities, while being polymorphic, in C, then being small and fitting in the code-cache, with their buffers being reused (and not in the function body) so fitting in the data-cache, then that what would seem "less efficient" compared to "plain old printf & friends", isn't much different time-wise, perhaps even faster for usual considerations where it's just the same as "i_to_a" and "a_to_i", and getting those right including validating (invalidating) the inputs is the same problem, and much all there is to it. "What if I want what only printf can do?": then make for passing it a function pointer and buffer and and size and have it can-do however you like, else that simply there's only so many types and only so many formats then that according to _type_ then the _Generic construct and __auto_type can make it nicely overloaded then underloaded and hide all the specific behind "prfmt" and "fro_str".