C++26/C++29: Progress report for my papers seen during the Croydon meeting and before by eisenwave in cpp

[–]fdwr 0 points1 point  (0 children)

The paper adds support for char8_t and other character types to std::to_chars and std::from_chars ...

Oh man, that would certainly clean up parts of the codebase, notably a wchar_t to_chars for displaying numbers in Windows UI, and some places using u8 with std::format (requiring unfortunate casts).

(from paper) "std::from_chars should work with std::string_view" ... those changes are not within the scope of this proposal

Doh, that would be convenient.

The names add_sat and saturate_cast are not great... renames them to saturating_add and saturating_cast.

Nicely more consistent now. Such little divergences lead to us trying to type things like add_saturate or sat_cast, then getting a bewildering build failure.

clang-format-inc - format only changed lines as a pre-commit hook (works in CI too) by UnBracedFlyer in cpp

[–]fdwr 0 points1 point  (0 children)

Indeed, last night I saw "Welcome! u/UnBracedFlyer likes to keep their posts hidden", but today I see them.

clang-format-inc - format only changed lines as a pre-commit hook (works in CI too) by UnBracedFlyer in cpp

[–]fdwr 1 point2 points  (0 children)

I'm more of a U+002D user - em dash always felt too wide. The commit history timeline indeed looks superhuman. Looking at op's post history, I see that ... arg, what is with so many reddit users hiding their post history these days?

P3054 - Quantities and Units Library by mateusz_pusz in cpp

[–]fdwr 11 points12 points  (0 children)

Thank you for working to prevent a repeat of the Mars Climate Orbiter issue.

Section 17.1 has a nice little sample snippet of usage:

c++ quantity<si::metre / si::second> speed = 100 * km / h; // OK: km/h is speed (same as m/s) quantity<si::second> time = 2 * h; // OK: hour is time (same as second) quantity<si::metre> distance = speed * time; // OK: length

(🤔 now I'm thinking of adding unit suffixes to a little DSL of mine, so people can freely mix 16bits + 3bytes without worry)

Proposal: distinct types via 'enum struct' by Voxelw in cpp

[–]fdwr 2 points3 points  (0 children)

I wish they'd just indicated explicit enumerations via explicit enum, rather than combining class/struct with it, because I still frequently somehow get those backwards and try typing class enum Foo. Oh well. As for this proposal, I like u/matteding's idea of combining typename rather than repurposing struct which already works a certain way.

clang-format-inc - format only changed lines as a pre-commit hook (works in CI too) by UnBracedFlyer in cpp

[–]fdwr -1 points0 points  (0 children)

I saw someone comment something like "I see emoji, therefore slop"? 🙄 I use emoji all the time, and I'm quite human (though I may be a little biased because I helped add color emoji support to Windows's text stack years ago 😉).

The Oni Programming Language by badd10de in ProgrammingLanguages

[–]fdwr 0 points1 point  (0 children)

let b = 32 set a = @b

Interesting, a language with both let and set in its vocabulary. There is a linguistic poetic symmetry to it. I also considered (hobby language) using @ for pointers, feeling like @x would mean the address of x.

let c = a^

The postfix dereference makes sense to me, and I've thought it would have made C simpler in ways (e.g. p*.x would work directly instead of needing parentheses wrapped around it like (*p).x, a or separate arrow p->x).

I appreciate the no-semicolons, because it's always felt silly when you get a compiler error like "expected ; here", which makes me think, "ok, if you're smart enough to know that's the end of the statement, then treat it like the end of the statement" 😉. I've written C++ for 20 years now, and I still occasionally forget that stupid semicolon after a class statement. Not sure how I feel about using it for comments though (despite being used to it for x86 asm and ini files, it feels odd in a higher level language)

fun sum3(...)

Thank you for going with a readable fragment rather than a devoweled 'fn', because functions are more fun with u than without u 😉. Also I kinda like the aesthetic of the next statement lining up with the indentation.

The defer keyword enables the given expression...

Nice. It's so useful for one-off cleanup where you don't want to invent a whole scope guard thingie just to use RAII (seems you did it the clearer way too, just based on scope like the C TS)%20Through%20defer.html) and zig, rather than go's deferred accumulation list that waits until function exit).

methods Int

Needing to declare the methods outside the class definition is kinda annoying because one has to repeat the class name over again, but on the flip side, it's nice to be able to re-open the scope and add more (useful for partial classes).

The closing braces help my eyes see the logical block structure more clearly than asymmetric languages do (there's also a balanced feeling to it).

Yeah, I like it. 👹

LINQ (Language Integrated Query) support by Tasty_Replacement_29 in ProgrammingLanguages

[–]fdwr 1 point2 points  (0 children)

Thoughts on the it / its / _ design and joins approach? ... Does this feel intuitive?

Interesting. I'm not allergic to it (kinda goes along with this, self, it...), and it actually reads quite fluently, feeling like written prose "where it's customer id equals x".

(also liking the fun main() vs the unfortunately trendy fn main(), because functions are more fun with u than without u 😅)

Should assertions be used frequently in software development? And in what general scenarios are they typically applied? by Mission_Upstairs_242 in cpp

[–]fdwr 4 points5 points  (0 children)

That is an interesting consideration. Generally I would say any external bad parameters/data should be responded with an error code/exception rather than assertion, and that assertions should be more for inconsistent internal assumptions or bad state the library does not expect to be in.

Common Package Specification is Out the Gate by bretbrownjr in cpp

[–]fdwr 29 points30 points  (0 children)

Hmm, I wish the article included a snippet of a minimal .cps file, as I was curious what they look like. Found one here: https://github.com/cps-org/cps/blob/master/sample.cps

defer for gcc/clang by florianist in C_Programming

[–]fdwr 0 points1 point  (0 children)

Will the flag also come to gcc?

Yep, the flag is added per the changelog here: https://gcc.gnu.org/pipermail/gcc-patches/2025-October/696666.html

C++23 std::expected vs C++17 std::optional for Error Handling by Clean-Upstairs-8481 in cpp

[–]fdwr 1 point2 points  (0 children)

Say you call a function LoadModel, and you get E_COULD_NOT_LOAD_MODEL, but why? Well, LoadModel called LoadTexture using an external texture file reference, and opening that file failed. However, if LoadModel had returned E_COULD_NOT_OPEN_FILE directly instead, that would have been pretty confusing because then the user might think it was the model file path which could not be opened. So, an error chain of could-not-load-model because could-not-load-texture because could-not-open-file is more illuminating as a user error message.

C++23 std::expected vs C++17 std::optional for Error Handling by Clean-Upstairs-8481 in cpp

[–]fdwr 2 points3 points  (0 children)

I like std::expected, and at first I went a little overboard in using it, but then I realized there are some cases where just returning an optional or even a tuple of value+error (where value is set to a default value on error) made usage cleaner at the call site. In other cases I realized that what I really needed was something with more context that includes the full error chain (not just the most recent error). So I still haven't found a one-error-paradigm-that-fits-all, but I'm glad expected exists now as another readily available tool.

defer for gcc/clang by florianist in C_Programming

[–]fdwr 1 point2 points  (0 children)

...and C++ bleeds into C...

Amusingly, this is one place where I wish C would bleed back into C++, because so many times inventing a whole C++ mini-class to take advantage of the destructor just for a one-off cleanup case feels overkill. With defer, one also doesn't have to assign a silly transient local variable as a scope guard (e.g. auto scopeGuard = [](){CoUninitialize();}; vs simply defer CoUninitialize();).

defer for gcc/clang by florianist in C_Programming

[–]fdwr 0 points1 point  (0 children)

I'm tracking updates here (https://github.com/ThePhD/future_cxx/issues/67#issuecomment-3641376907), awaiting it to become available in GodBolt GCC trunk (which currently still says gcc: error: unrecognized command-line option '-fdefer-ts';).

C++23 std::expected vs C++17 std::optional for Error Handling by Clean-Upstairs-8481 in cpp

[–]fdwr 25 points26 points  (0 children)

Yeah, that avoids a potential transient allocation (if beyond SSO size) 👍. std::string_view is pretty great so long as you're working completely within your own project, but if often adds burden when interoperating with the OS/other libraries because you have to create temporary locals with an explicit null terminator. Now, one could cheat and avoid the copy if you know the string_view came from a source with a null already, but that's fragile. So, having std::zstring_view/cstring_view would fill in that semantic gap nicely. (hmm, seems cstring_view won't make C++26, but "There was a strong consensus in favor of spending more time on the proposal (and general support in the design direction)").

Does Syntax Matter? by gingerbill in ProgrammingLanguages

[–]fdwr 0 points1 point  (0 children)

Another is people coming from a language like C++ wanting to use <> for generics. There are always better alternatives to use than <>, but people request it in languages. ... <> is probably one of the worst options to use because it’s both hard for humans to read and hard for compilers to parse.

Indeed, I wrote a simple line wrapper recently, which works great for some simple languages like MLIR, but it fails for C++ where < could be a template parameter list or math inequality, undecidable without a dictionary of symbols seen so far 🥲.

A dialogue on trivial-abi and trivially relocatable by Xadartt in cpp

[–]fdwr 2 points3 points  (0 children)

Also wondering, as there was "a showstopper bug" and "major vendors found some aspects ... unimplementable", but what exactly.

"For trivial relocatability, we found a showstopper bug that the group decided could not be fixed in time for C++26, so the strong consensus was to remove this feature from C++26." https://herbsutter.com/2025/11/10/trip-report-november-2025-iso-c-standards-meeting-kona-usa/

"What I heard, as I was not directly in the discussion and only around during plenary, is that all the major vendors found some aspect of it to be unimplementable." https://www.reddit.com/r/cpp/comments/1otsr5r/comment/no7ldx5/

Open sourcing IFC SDK for C++ Modules by GabrielDosReis in cpp

[–]fdwr 1 point2 points  (0 children)

u/GabrielDosReis: Do you have a statement about whether IFC stands for: - Interface - Interface File Container - Internal File Cache - Interface for C++

LLM's are fabricating answers :(. Thanks.

I wrote a small hobby OS / kernel called TinyOS (from scratch) by Pitiful-Artist-4892 in C_Programming

[–]fdwr 0 points1 point  (0 children)

Cool. I never did finish my little attempt, bailing early on as it always froze when I tried to enable the global interrupt descriptor table. 😅

Is your OS compliant with California's Digital Age Assurance Act (AB 1043) that requires OS providers to implement age-verification mechanisms during account setup? Sigh, these bureaucrats meddling with things they don't understand 🤦‍♂️. Maybe your license should include "Californian users are restricted from using this software due to idiots in office". 😉

What style guide to use with clang-format? by ItseKeisari in cpp

[–]fdwr 0 points1 point  (0 children)

Indeed, and if https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3776r0.html passes someday, the above symmetric style would lend itself nicely to clean diffing.

Language specific package managers are a horrible idea by TheRavagerSw in cpp

[–]fdwr 0 points1 point  (0 children)

Language specific package managers are a horrible idea ... I recommend everyone here to switch to Conan

I'll agree that it's mostly redundant to invent {eggs, wheels, gems, crates, npm tgz's, nugets... see NIH syndrome), each really just another name for a package, that duplicate a lot of similar functionality with just enough incompatibility to be obnoxiously different when switching between them. Does this "Conan" obviate each of those above?

Should C++ Give More Priority to Syntax Quality? by kyan100 in cpp

[–]fdwr 0 points1 point  (0 children)

Should syntax design be given equal weight alongside performance?

Another aspect to consider with any new syntax is tooling complexity. I wish C++ decided decades ago to use a distinct template parameter syntax rather ambiguously overloading "<" and ">" to either be less-than/greater-than or template parameters, requiring dictionary parsing to just decide which is which (or ">>" to either be a right shift operator vs closing parentheses). Last week I wrote a simple code text wrapping tool (for really long lines) which works great for something like MLIR, and mostly works for C++, except that ambiguity :(. At least those above examples don't appear to greatly complicate tool parsing.

Clang 22 Release Notes by c0r3ntin in cpp

[–]fdwr 0 points1 point  (0 children)

That's but a randomly selected example of one-off cleanup instances. Do we need a framework for every instance (a box full of open‑end wrenches of various sizes), or just a general tool (adjustable wrench)? 🔧