Article View: comp.lang.c
Article #1876Re: C and its pesent 'ancestos'
From: Ross Finlayson
Date: Thu, 26 Nov 2026 18:10
Date: Thu, 26 Nov 2026 18:10
255 lines
14502 bytes
14502 bytes
On 11/26/2026 09:00 AM, Ross Finlayson wrote: > On 11/26/2026 08:43 AM, Ross Finlayson wrote: >> On 11/26/2026 08:09 AM, Bonita Montero wrote: >>> Am 26.11.2026 um 16:02 schrieb Ross Finlayson: >>> >>> You’re jumping from one topic to another—going off on tangents. >>> I’m pretty sure I can’t follow you. I mean, I can follow what >>> you’re saying, but I’m wondering how it fits into the context >>> you’re responding to. >>> >>>> One challenge I'm trying to figure out is basically >>>> about strings and that strings are variable-length. >>>> >>>> So, with basic operations on strings including things >>>> like "concatenate" and "truncate", then how to deal with >>>> the buffers is being a thing, where for example languages >>>> like C++ their standard implementations of basic_string >>>> for std::string might stuff a "small" string into the object's >>>> own representation on the stack, otherwise on the heap, >>>> or for example the data-segment for "constant" strings, >>>> and including ideas like "string atoms" a.k.a. "string internment". >>>> >>>> So, there's the stack and the heap, with regards to things >>>> like "variable-length-arrays", basically for the strings and >>>> mostly the algorithms on them like substitution/interpolation, >>>> and formatting among all the various types, for basically an >>>> "output" case and an "input" case to algorithms, then to >>>> result that to all the standard routines it's a "char *", >>>> so usually. >>>> >>>> >>>> You might think of that as a natural algebraization about >>>> the usual formal language's account since concatenation >>>> and the empty string, what operator-overloading "+" makes >>>> for string vis-a-vis whatever types and formatting them >>>> to string, and what operator-overloading "-" makes for >>>> truncation and whatever type is to indicate what/how/where >>>> is to be truncated, about truncation & concatenation, >>>> formatters & converters, and operations on strings (or >>>> for example any other account of growing | shrinking "arrays"). >>>> >>>> >>>> Of course C doesn't have "operator-overloading" in the language, >>>> yet so that concatenate() and truncate() can be given >>>> function-overloading via _Generic in C, then that it's sort of >>>> "reverse-reverse >>>> Polish notation" like as for a usual stack-notation >>>> operand-operand-operator that it's function-operand-operand of the >>>> operator, pair-wise. >>>> >>>> >>>> Then, there's * and /, the arithmetic operators, and an idea about >>>> whether that's to align quite directly with the notion of >>>> pointer-indirection quite like "+" aligns with concatenation, here >>>> though >>>> basically to make for assignment-targets and the scope & state, >>>> that what enters-scope and embodies-state in block-scope then >>>> function-scope then globals by being reference-able, about what >>>> "*" and "/" can mean, or for example "*=" and "/=", about basically >>>> what makes for in-parameters and out-parameters, these kinds of >>>> things, and not exactly like move semantics, instead basically >>>> into-the-stack or offto-the-heap, as it were. >>>> >>>> >>>> About then "natural" "algebraizations" about the syntax of the >>>> language and its cousin(s), here is about concepts like "seating" >>>> the references vis-a-vis "homing" the references, in a language >>>> like C where there are only _pointers_, that it results for >>>> type-safety that pointers are furthermore _typed_ as to result >>>> then for either behaving like "seating" the references in C++, >>>> or not, when for example the growing | shrinking of the textual >>>> data, or other accounts of tuples or lists or otherwise "arrays", >>>> has an entirely different approach that's yet on its own account, >>>> "natural". >>>> >>>> >>>> The concatenation and truncation, for example, one might aver >>>> looks like >>>> >>>> s += 1 >>>> >>>> intuitively formats the integer, according to formatters & converters, >>>> then for example where >>>> >>>> s -= 1 >>>> // or >>>> s -= -1 >>>> >>>> truncates from the right or left, intuitively then toward the >>>> "natural" that's what intuitive about the scope & state and >>>> left/right branching in the procedural language, is "natural" >>>> in the up/down jumping on the program counter, scope & state >>>> on the core/CPU, and giant uniform global memory, scope & state >>>> the RAM, that "scope" and "state" make a stack in the procedural >>>> definition, and two different things, yet an array and constant >>>> block as >>>> "CPU" or "RAM", the contents, and one thing. >>>> >>>> >>>> So, one may aver that accounts of "typing the pointers" can make >>>> for example pretty much exactly like C++, or quite entirely different, >>>> then to result a model of "natural operator overloading" that results >>>> "plain syntax in what happens to be the arithmetic operators instead >>>> of the reference operators", arithmetic on scope & state. >>>> >>>> >>>> >>> >> >> >> Hello. It's not much speaking to "C and its present ancestors", >> (not, "C and its peasant ancestors") except about the "natural" these >> days I guess they're calling it "mechanical sympathy" or >> "close-to-the-hardware", yet also that there's the process & thread >> model and the heap & stack model, "systematic sympathy", if C was >> "declarative flow-of-control, close to the hardware", that what's >> involved about state & scope is also about the process & thread and >> stack & heap. >> >> >> So, the usual account of dynamic allocation of textual data or strings, >> or bytes, here calling "unsigned char" byte_t and "signed char" char_t >> since those are un-used and probably will be un-used forever in C and >> C++ themselves, about the implicits according to _types_ in C and C++ >> (or, "C/C++" when the same code is hidden inside "__cplusplus"), then >> is about _types_ in C, and adding only a few types to the language, >> that are fixed-size, yet quite large than a register word, and usually >> accounts of multiples of cache-line size (LINE_SIZE, here when it's "64B >> these days, 32B not so long ago, often in pairs of cache-lines 128B, yet >> pretty much about 64B), for cache-coherency, page size (PAGE_SIZE, the >> system's account of the memory page, mostly 4Kib), >> then that char_t and byte_t are according to the least-addressible >> memory location, line-size the least-granular cache-content, and >> page-size the least-granular virtual memory page used for all purposes, >> these then being natural "types" according to C. >> >> >> So, any of these, is an integer multiple of the smaller ones, basically >> making for "slab allocators" the usual enough account, with that about >> 5% of the lines in the page are housekeeping, rest data, about 64B and >> 4KiB or 4096B, vis-a-vis, 8B the 64b register-word, and the calling >> convention of the preserved and scratch registers and what the >> convention says to do. >> >> It's figured that these types according to the processor's "RAM" >> the LINE_SIZE and system's "RAM" the PAGE_SIZE, are always going >> to be so, not change for a generation and a half, and otherwise >> are parametric and parameters, i.e. constants. >> >> >> >> So, there's an idea to use "*=" and "/=", like "multiply" like "copy" >> or "divide" like "carve", to make allocation first-class in terms >> of what were called "glo-calls", globals to process & thread, vis-a-vis, >> "sys-calls", like malloc & free, or here mostly about alloc_aligned & >> free, figuring never to call malloc ever again, >> except that user code can do what it wants since programmer's intent. >> >> >> > > > Say for example there's a function and it calls functions and > these functions return char-pointers or otherwise anything that's > dynamically-allocated. So, the usual idea like new & delete is > that either it has an allocator passed to it, or for that of > course there was "placement-new' long before there was "move semantics", > that it's much about "placement-new" from C++, > that the caller allocates a block/slab on the stack and expects > callee's to carve from the block/slab, though, it doesn't necessarily > know how much to allocate, to avoid "too much" or "too little". > > Then, if the called functions need more to result the out-params > as they would be, for example under pointers usually in C or C++ > and "mutable references" usually enough in C++, about "the seating > of references", and not getting into the distinct dialects of templates > & procedural code about "the universal & forwarding ref-ref among > accounts of l/r/x/pr/rr-values along with pointer-decay and auto and > decltype the C++ 11 <-> 14", so, about "placement-new" vis-a-vis > "seating the references", basically is about placement-new, then > about caller laying the bed for what it expects in return, or, > taking upon itself the allocation and free-ing, or responsibility, > of distinguishing among called-functions what are state-less or > plain-old pure, idempotent functions yet as their monad's a terminal. > > > Then, the idea here is that callee's have a convention about > thread-locals and stack-relatives, that's their default allocator. > > > So, "uses of placement-new", in "conventions of types", about, > "conventions of locals (globals)", is the sort of idea. > > > Then the idea is that results "naturals" like "copy or carve" (in C, > which happen to have most simple sorts of operator-overloads). > > Basically it's also an account of "allocation only returns one of > LINE, PAGE, or HUGE size, and only one of those, allocate1(slab_t slab)" > then for reference-routines of hyper-local allocators. > > > About "placement-new" is, "placement-new" is ye olde way. > > > (Of course above there where I wrote "signed char" that's wrong, since it's defined by the implementation or usually compiler switches, then about the "... and decltype" then also is "the const and non-constness what whether you mean const or not or just in/out", that, you know, "in or out" is one of the usual things, vis-a-vis that const is more than less a hint, that the compiler can enforce while consumers ignore. I rather don't care whether char is signed or unsigned or what is its default, yet that in accounts like the processor instructions about compare whether they exist for both signed and unsigned, pretty much don't care as a suitable type would be used instead, that "char" just happens to be the most common type of expected C-strings in any sys-call expecting a C-string or array of C-strings.) So, the idea is that called-functions need some unknown amount of memory, that basically they get from the caller-function, who in its stack & heap, may be responsible for itself and its called-functions, basically usually looking to put its locals on the stack while it's yet a reasonable account of how much stack-memory a long-lived thread, for example, may have, then that both stack & heap together are "storage" as far as the language cares, yet visible for scope & state in the process & thread as far as the runtime/host cares, then about CPU & RAM memory as far as the processor cares. "Close to the hardware", then, and "in the language", is to be making for both "not too close" (to the least addressible unit of memory) and "not too far" (from the account of proximity and distance in memory), of the combined scope & state of the CPU (it can see all the registers), combined scope & state of the RAM (it's one contiguous name-space of memory), and block- and function- scoped account of thread- and process- state, and vice-versa, process- and thread-scope, and function- and block-state. Then, "placement-new" is the account of C++ for the lifecycle of objects giving them a place to live, about this "carving" (allocating) and "imbedding" or "inlaying" (free'ing), where the idea is that there's a usual account where C++'s is not apropos and Rust's "borr-w-checking pointer-stealers" is not apropos, yet that can be in C and "in the language" and "strongly-typed", with a brief account of reference routines after abstracting away standard libraries with "glo-calls" then for "sys-calls", where an account of "state & scope" then means never having to ask for a buffer because the caller's responsible for providing one (or getting more).
Technical Details
Message-ID:
<DJGcnZFULfeg65X2nZ2dnZfqnPqdnZ2d@giganews.com>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!weretis.net!feeder9.news.weretis.net!border-1.nntp.ord.giganews.com!nntp.giganews.com!Xl.tags.giganews.com!local-3.nntp.ord.giganews.com!news.giganews.com.POSTED!not-for-mailReferences:
<11dup6q$v4j9$1@dont-email.me> <11e0kde$1jpvu$1@dont-email.me> <11e0r13$1lqm6$1@dont-email.me> <11e0uc0$1mtpv$1@raubtier-asyl.eternal-september.org> <11e7fj4$37l9$1@dont-email.me> <11e8oro$ft4l$1@raubtier-asyl.eternal-september.org> <11e8stp$hajr$1@dont-email.me> <11e8ti0$hhqa$1@dont-email.me> <11e8v24$i2mc$2@raubtier-asyl.eternal-september.org> <11e9045$ihk3$1@dont-email.me> <11e90j7$io87$1@raubtier-asyl.eternal-september.org> <0oSdnUooBKya15X2nZ2dnZfqn_udnZ2d@giganews.com> <11e9lje$qt1s$1@raubtier-asyl.eternal-september.org> <tJqcnayyjasu_JX2nZ2dnZfqnPGdnZ2d@giganews.com> <ZLKcnezYXoNE-JX2nZ2dnZfqn_SdnZ2d@giganews.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!weretis.net!feeder9.news.weretis.net!border-1.nntp.ord.giganews.com!nntp.giganews.com!Xl.tags.giganews.com!local-3.nntp.ord.giganews.com!news.giganews.com.POSTED!not-for-mail NNTP-Posting-Date: Thu, 26 Nov 2026 18:11:09 +0000 Subject: Re: C and its pesent 'ancestos' Newsgroups: comp.lang.c References: <11dup6q$v4j9$1@dont-email.me> <11e0kde$1jpvu$1@dont-email.me> <11e0r13$1lqm6$1@dont-email.me> <11e0uc0$1mtpv$1@raubtier-asyl.eternal-september.org> <11e7fj4$37l9$1@dont-email.me> <11e8oro$ft4l$1@raubtier-asyl.eternal-september.org> <11e8stp$hajr$1@dont-email.me> <11e8ti0$hhqa$1@dont-email.me> <11e8v24$i2mc$2@raubtier-asyl.eternal-september.org> <11e9045$ihk3$1@dont-email.me> <11e90j7$io87$1@raubtier-asyl.eternal-september.org> <0oSdnUooBKya15X2nZ2dnZfqn_udnZ2d@giganews.com> <11e9lje$qt1s$1@raubtier-asyl.eternal-september.org> <tJqcnayyjasu_JX2nZ2dnZfqnPGdnZ2d@giganews.com> <ZLKcnezYXoNE-JX2nZ2dnZfqn_SdnZ2d@giganews.com> From: Ross Finlayson <ross.a.finlayson@gmail.com> Date: Thu, 26 Nov 2026 10:10:58 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <ZLKcnezYXoNE-JX2nZ2dnZfqn_SdnZ2d@giganews.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Message-ID: <DJGcnZFULfeg65X2nZ2dnZfqnPqdnZ2d@giganews.com> Lines: 255 X-Usenet-Provider: http://www.giganews.com X-Trace: sv3-6qZwlhhgNaKv+UUbVrUhSq08Sy77+ziojW0YfF0PMErgsWkuTFQnvO65Le2XL3MgJtIDAsYaY46OTQD!OdSv0uPlpM6tAjniDCVxqDYJAYL9LqUKuj/MDLRN+3garZf9m6T+GYSWg0EgcqhXaVMmDQmyzfMt X-Complaints-To: abuse@giganews.com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40