1,545 karma · joined Aug 14, 2022 (4y ago) · 937 submissions
comment 1h ago · link · parent
Fair enough. As long as it's not confused by literals like 1'000 and 0b0110, attributes in the form [[...]], new keywords as "constexpr", or a subscript qualified with "cost" or "static" in the parameters list.
> typedef creates an alias for an existing type, not a new type
Exactly. C is based on the concept that you can express (nearly) every type when you need it, even without giving it a name. In some cases you might need to create a new tag, but not a new type. Why your sum types are different? Why don't you handle them like their "sibling" structs, unions and enums? Forget the keyword "type", define the keyword "variant", rewrite your example like this:
variant eval_error {
DivByZero,
Overflow
};
You can typedef it, but it's not mandatory: typedef variant eval_error EE;
To allow recursive definition, use forward declaration as all the rest of C: variant expr;
variant expr {
Num(int value),
Add(const variant expr *l, const variant expr *r),
Mul(const variant expr *l, const variant expr *r),
Div(const variant expr *l, const variant expr *r)
};
It's more verbose but consistent with C syntax. And it allows one-shot declarations without naming a new type like: variant {Ok(float), Inf} atan(float);
Not saying it's better. Just more familiar.> Anonymous types will need a stable name across interfaces,
I don't think so. If anonymous structs and unions don't have this property, why should variants? (But you might consider how C23 handles structs with the same tag!)
comment 16h ago · link · parent
Why C11? We're in 2026, we should target C23 at least, with a forward look at C2y.
Why the keyword "type"? Can't the same functionality be added within a typedef statement? Is there a reason why "|" can't be recognized wherever a type is expected?
And finally, the name "Type-C"... Isn't it already closely associated with USB connectors?
comment 2d ago · link · parent
The name suggests it is the willingness to use the swapping mechanism, while it is the willingness to use the swap partition (or file). The variables anon_prio and file_prio that the kernel uses internally are much clearer!
comment 2d ago · link · parent
Which, in turn, is slower than not swapping at all. To avoid swapping unless absolutely needed, you set swappiness to 0. On the opposite side, to swap as soon as the kernel sees an opportunity, you tune swappiness to 200.
comment 3d ago · link · parent
I can't follow your reasoning. On the one hand you want the fastest access, on the other you advocate for high swappiness.
I think you should want swappiness=0, then the swap device can be whatever: it will be hardly ever used.
comment 1w ago · link · parent
So humans end up taking the final decisions and remain the bottleneck.
comment 1w ago · link · parent
comment 1w ago · link · parent
2. I agree if you refer to TUIs that try to emulate/substitute complex GUIs, with sub-panes, dialogs, graphics, etc. I happen to love TUIs for simple text-only visualizations, though. They are usually quicker than GUIs and consistent among various OS, desktop...
comment 1w ago · link · parent
To be more precise, TERM contains a single name, a key to index terminfo, a database of all known terminals and their capabilities. It assumes that such database is up to date and that every app has access to it, which is not always true, especially on non-unix platforms.
However, apps have begun using the name "as is", comparing it against known strings, e.g. "xterm", which led many terminals to advertise themselves as xterm just to ensure compatibility with existing apps.
A truly meaningful substitute for TERM would be a "semantic TERM", a variable that, setting apart the name of the terminal, focuses on the capabilities it offers. Not the complete set of properties listed in terminfo (we can give most of them for granted, today), but just the subset that differentiates modern terminals, like colors, kitty's protocol, OSC133, and a few others.
comment 2w ago · link · parent
What about Turkey? (I consider it among the parliamentary republics as it was so until 2017, when the authoritarian shift was already ongoing. In other words, the sequence has been: parliamentary, then turned authoritarian, then changed to presidential.)
comment 3w ago · link · parent
That's what I assumed, but honestly I might have misunderstood the docs. This passage is not very clear:
> Copper manipulates only references to objects. Simple data types such as integers must be seen as references to stateless objects (i.e. objects that have no state in memory).
comment 3w ago · link · parent
For example, variable declarations use the pattern <colon> <type>, as in
var a: Int32
But literals follow the opposite syntax, as in a = Int32: 42
The return type of a function is introduced by : in func definitions, but by -> in imported func declarations: func foo(a:Int):Int
import func bar(a:Int) -> (Int)
Other construct that I find far from my habits: var w, h, d = 640, 480, 2
instead of the more obvious (for me): var w=640, h=480, d=2
Arguments are passed by ref, not by val. Good luck with recursion!comment 1mo ago · link · parent
comment 1mo ago · link · parent
> Mine include the privacy concessions during setup, the years spent waiting for Microsoft to let people put the taskbar on the side of the screen again, and the advertising.
Of course you don't have to agree on all of them, but please don't assume everyone acts only because they can't find a tutorial on the net!
comment 1mo ago · link · parent
I agree to everything except waking up every day to a full "tank". That's only if you have your own house. If not, you'll depend on public chargers, so you'll buy "fuel" at premium prices, possibly higher than petrol, and you'll have to move your car at the end of the recharge in the middle of the night to avoid the parking fee.
comment 1mo ago · link · parent
One of those is the two-stage CAT, another one is the NARG the article talks about.
__COUNTER__ is going to be added to C29, the next version of the standard, maybe there's hope for __VA_COUNT__ and __CAT__ too!
comment 1mo ago · link · parent
Also, your code is prone to overflow when you add data, used, alignment and size.
And finally, the realloc function could be reworked to do nothing if new_size is <= old_size.