frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

C++26: Std:Is_within_lifetime

https://www.sandordargo.com/blog/2026/02/18/cpp26-std_is_within_lifetime
36•ibobev•1h ago

Comments

eptcyka•54m ago
C++ people will point to this and say *See, C++ is still evolving and we ARE taking memory problems seriously*. You sure are, gramps.
bvrmn•6m ago
Naming is atrocious indeed.
mFixman•53m ago
Is this the first type of sum-type option choosing statement present for C++ unions? I've been waiting for this feature since the year 1978.

Still, it's a wasted opportunity not to have a language-level overload to the `switch` statement that allows nice pattern matching. Even with std::is_within_lifetime C++ unions are prone to errors and hard to work with.

sebtron•38m ago
Since C++17 there is std::variant

https://en.cppreference.com/w/cpp/utility/variant.html

matthewkayin•51m ago
The problem pointed out in the article seems a little silly. We're adding an entire language feature because someone wanted an optional bool class? Why not just create a uint8_t with three values: OPTIONAL_BOOL_FASLE, OPTIONAL_BOOL_TRUE, OPTIONAL_BOOL_UNDEFINED?

Doing so takes the same space as a bool, and could be wrapped in a class if desired to provide a nicer interface.

ephou7•41m ago
Exactly my thought. Or a typed enum: enum class uint8_t { NAH, YEAH, OMGWTF };

I'm (fairly) sure there's a good reason for that language feature, but the justification the blog article gives is super weak.

tialaramex•17m ago
Well, here's Barry's actual proposal paper: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p26...

The language is the problem, and WG21 hates fixing the language. The really bone headed stuff like "UB? in my Lexer?" got through as a language change and Barry has also had some success with "just fix it" language changes, that's what happened so that C++ can attempt what Rust's MaybeUninit<T> does, but mostly WG21 will take weird new intrinsics in the standard library, as here, over just fixing the programming language.

yearolinuxdsktp•9m ago
What do you think the programming language fix would be?
IsTom•35m ago
Ah, the good old True, False, FileNotFound.
cataphract•19m ago
It was an example. The point was to make untagged unions usable in constant evaluation contexts.

What I was surprised with was that their union code was valid. I thought accessing a union member that was not active was valid in C, but not in C++.

MountainTheme12•50m ago
In my C++ all members of a union are always active.
ux266478•22m ago
It's the only way to live. Strict aliasing rule? Always disabled.
irishcoffee•48m ago
This could be neat, maybe. I'll never use it.
pif•43m ago
If only people learnt to program properly and ditched unions completely...
worldsavior•38m ago
Mature lanagues like CPP should stop adding more features to the language/std. Adding features to the language just makes it more complex, and adding to the std library just adds more overhead, and maybe even security issues.
alphazard•22m ago
What no one wants to hear is rust is destined for the same fate. If you want to see the future of rust, look at C++. Rust has a much better initial state, but the rules evolving the system (the governance model, the kinds of developers that work on it, etc.) are the same as C++ and so we should expect the same trajectory.

Unless you have a system that says "no" a lot, and occasionally removes features, programming languages decay, and the game has been (historically, before LLMs) to pick a language that would be in the sweet spot for the time that you need to use it, while keeping your eye out for something else to switch to once it becomes sufficiently unusable.

raincole•17m ago
Is there ever a successful programming language that occasionally removes features? Like, not just a big, one-time backward-incompatible upgrade, but occasional feature removal?
lights0123•15m ago
Python removes features all the time in 3.x releases. For example, I was not a fan of the distutils removal in 3.12 which broke many legacy but otherwise functional packages. Deprecated functions and classes are also removed from packages regularly.

They do publish removal plans years in advance, e.g. see Python 3.17's plans: https://docs.python.org/3/deprecations/pending-removal-in-3....

jasode•6m ago
Examples of C++11, C++17, C++20, C++23 that removed features. Some deep links:

https://en.wikipedia.org/wiki/C%2B%2B11#Features_removed_or_...

https://en.wikipedia.org/wiki/C%2B%2B17#Removed_features

https://en.wikipedia.org/wiki/C%2B%2B20#Removed_and_deprecat...

https://en.wikipedia.org/wiki/C%2B%2B23#Removed_features_and...

pjmlp•4m ago
Java, since Java 9 deprecated for removal really means it.

.NET, the whole .NET Framework to modern (core) .NET migration, left several parts behind, the foor loop semantics change on C#, introduction of field keyword, and with.

hypeatei•13m ago
Rust intentionally keeps its std library small and makes no promises about ABI; it seems to have resisted a lot of pressure to do the opposite from C++ fanatics. I don't agree that the C++ path is inevitable.
simonask•4m ago
What are you talking about? Rust governance could not be more different from C++.
armchairhacker•3m ago
Even Go is encountering the same fate, albeit slower. It’s nearly impossible to remove a feature once it has seen adoption, especially without an alternative; whereas there are always patterns that are greatly simplified by some new feature, and when a language becomes large, these patterns become common enough that the absence of said feature becomes annoying.
Blackthorn•6m ago
You can just set -std=c++03 and program like the language never evolved if that's your personal preference.

Other than that, there's always an interesting psychology at play in software engineering but it really seems to come out when people talk about C++ for some reason. Complexity is just needless bloat when it's a feature you aren't using, and it's an essential part of the language when it's a feature you are.

tw1984•37m ago
you really need to hate yourself to still pay attention to such horrible stuff in 2026.

41 years after its invention, C++ still doesn't have networking support in its stdlib. excuses after excuses, they have millions justifications on why the stdlib doesn't need networking. but in the same time, some bureaucratic "committee members" struggling with their midlife crisis want you to waste your life on stuff like Std:Is_within_lifetime in the era of AI.

what a bloody load of joke!

Can't wait to see some high accurate coding agents start being able to port C++ code to rust with minimum human interventions to liberate people from the most bureaucratic nonsense in CS history. Some AI native language incorporated with concepts that were too complicated for human would be even better.

it has never been a better time to depreciate dinosaurs like C++!

ethin•10m ago
Oh here we go again, someone demanding networking (of all things) in the standard library. Are you next going to demand a GUI toolkit too? Maybe an entire game engine and Vulkan/WebGPU implementation too while we're at it? Just because other languages do it does not mean it is a wise idea for C++ to follow suit. I mean, do I really need to point you to std::regex as an example of what happens when we try to add extraneous, hard to define problems to the STL? Do you really want to add something way more complicated than a regular expression engine to C++ (networking), with all that entails? Because I certainly don't.
dzdt•36m ago
This continues the trend that the C++ language spec is too large for any person to understand, full of opaquely named things for obscure use cases. Maybe when most code is written by LLMs this kind of extension will be appreciated? Because the LLM can manage to get its large head around all of these obscure functionalities and apply them in the appropriate situations?
raincole•32m ago
Since the birth of ChatGPT, people have been talking about if one day LLMs will be trained to write bytecode or even machine code directly, making future code incomprehensible for humans.

It'd be funny if it ends up being just C++35.

ainiriand•26m ago
I would love to see the first LLM shot in the foot with C++. I mean it is not like human devs don't do that right?
cbm-vic-20•19m ago
Or, like the Shakespeare programming language.

https://shakespearelang.com/

pjmlp•6m ago
It is hardly any different from,

C Source code => Tradicional UNIX C compiler => ASM => object file

Now everyone is doing

AI tooling => C Source code => Tradicional UNIX C compiler => ASM => object file

For all pratical purposes, just like using a language like Nim, the workflow exposed to user can hide the middle steps.

Then there is the other take, if you start using agents that can be configured to do tool calling, it is hardly any different from low code applications, doing REST/GraphQL/gRPC calls orchestrated via flow charts, which is exactly what iPaSS tooling are offering nowadays, like Workato, Boomi,...

secondcoming•17m ago
you don't have to use it
estimator7292•13m ago
The more I interact with consteval and the whole template metaprogramming and codegen paradigm, the more I think it's completely inappropriate to shovel into stdlib. I don't think this should even be part of the language itself, but something more like a linter on top of the C++ language.

For most of us it seems you can get good at C++ or metaprogramming. But unless you want to make it your entire career you can't really do both with the same degree of effectiveness.

I really like C++, and I will probably continue using it forever. But really only the very small subset of the language that applies to my chosen field. I'm a "C with classes" kind of guy and templates and constexpr are pretty rare. Hell, half the time I don't even have stdlib on embedded platforms. It's kind of nice, actually.

Blackthorn•4m ago
We find constexpr (and associated templates) essential for when we need to avoid branch penalties. It makes the code so much simpler and cleaner than the alternative. I'm glad the language caters to the needs of everyone, even if any individual person (self included) only uses a little bit of it.

How the US Won Back Chip Manufacturing

https://www.chinatalk.media/p/how-the-us-won-back-chip-manufacturing
1•iamnothere•23s ago•0 comments

Buses should not be "free"

https://mleverything.substack.com/p/no-buses-should-not-be-free
1•bko•42s ago•0 comments

The Biophysical World Inside a Jam-Packed Cell

https://www.quantamagazine.org/the-biophysical-world-inside-a-jam-packed-cell-20260218/
1•Brajeshwar•1m ago•0 comments

Show HN: VibeScan – Free client-side security scanner for AI-generated code

https://tools.pinusx.com/vibescan
1•dbhariprakash•1m ago•0 comments

The Human Exposome Project will map how environmental factors shape health

https://www.economist.com/science-and-technology/2026/02/18/the-human-exposome-project-will-map-h...
1•Brajeshwar•1m ago•0 comments

Brain-like computers could be built out of perovskites

https://www.economist.com/science-and-technology/2026/02/18/brain-like-computers-could-be-built-o...
1•Brajeshwar•1m ago•0 comments

New GoDaddy Terms of Service: we no longer serve "consumers"

https://domainnamewire.com/2026/02/19/new-godaddy-terms-of-service-we-no-longer-serve-consumers/
1•speckx•1m ago•0 comments

UMD Scientists Create 'Smart Underwear' to Measure Human Flatulence

https://cbmg.umd.edu/news-events/news/brantley-hall-umd-scientists-create-smart-underwear-measure...
1•ohjeez•1m ago•0 comments

The biggest app in the whole wide world

https://www.theverge.com/tech/876196/top-app-store-apps-developers
1•aarvinroshin•1m ago•0 comments

Google AI Studio and NBP are down

https://aistudio.google.com/status
3•boriskourt•2m ago•0 comments

Datadog: Give Your Agent a Puppy: Introducing Pup CLI

https://github.com/datadog-labs/pup
1•dpflan•2m ago•0 comments

Adquira agora Controle de VIPs e seguros para DayZ

https://www.dfg.com.br/pt/outros/gerenciador-de-seguros-e-vips-dayz-controle-vencimento-96422873
1•Baruki•2m ago•0 comments

Show HN: Design and print allergy cards for free in multiple languages

https://allergysafe.co/
1•dreadsword•2m ago•0 comments

Show HN: Feuxo – Real-Time hiring posts and contacts and personalized outreach

https://feuxo.com
1•KrishnaTorque•4m ago•0 comments

Gemini 3.1 Pro Preview

https://console.cloud.google.com/vertex-ai/publishers/google/model-garden/gemini-3.1-pro-preview?...
1•MallocVoidstar•4m ago•0 comments

Efficient Ralph Wiggum Loops on a Raspberry Pi

https://mfbt.ai/blog/efficient-ralph-wiggum-loop-raspberry-pi-mfbt/
1•shuss•4m ago•0 comments

You had a story

https://nolanlawson.com/2026/02/18/you-had-a-story/
1•MindGods•4m ago•0 comments

AICode: A VSCode methodology for long-term maintainable AI coding

https://marketplace.visualstudio.com/items?itemName=joelabenhaim.aicode-ja
1•bonjourjoel•6m ago•1 comments

Token Compression, achieving more with less

https://www.edgee.ai/blog/posts/2026-02-19-achieving-more-with-less-using-token-compression
6•sachamorard•7m ago•2 comments

Warning to Humanity: Why We Must Not Trust the AI "Fluency Trap"

2•jariamaria•8m ago•2 comments

Ask HN: Frameworks for 2D Browser Games?

3•tmaly•8m ago•1 comments

People Will Sometimes Just Lie About You

https://aella.substack.com/p/people-will-sometimes-just-lie-about
2•iamnothere•8m ago•0 comments

Waymo Faces Setback as New York Withdraws Robotaxi Service Plan

https://www.bloomberg.com/news/articles/2026-02-19/new-york-s-robotaxi-plan-pulled-in-setback-to-...
2•helsinkiandrew•9m ago•0 comments

The State of Machine Learning Competitions – 2025 Edition

https://mlcontests.com/state-of-machine-learning-competitions-2025/
1•willis77•10m ago•0 comments

How I launched 3 consoles and found true love at Babbage's store no. 9 (2013)

https://arstechnica.com/gadgets/2013/01/how-i-launched-3-consoles-and-found-true-love-at-babbages...
2•zepearl•10m ago•0 comments

Can LLMs Play Catan?

https://visakhmadathil.com/blog/2026-02-09-can-llms-play-catan
1•forwardalways•10m ago•0 comments

Canaries in the Coal Mine? Six Facts about the Recent Employment Effects of AI

https://digitaleconomy.stanford.edu/publication/canaries-in-the-coal-mine-six-facts-about-the-rec...
1•DGAP•11m ago•0 comments

OpenClaw security fears lead Meta, other AI firms to restrict its use

https://www.wired.com/story/openclaw-banned-by-tech-companies-as-security-concerns-mount/
1•voxadam•11m ago•0 comments

Running Cosmos-Reason2-2B on 8GB Jetson Orin Nano

https://huggingface.co/embedl/Cosmos-Reason2-2B-W4A16
1•Embedl-Wilhelm•11m ago•1 comments

Show HN: FSM-agent-flow – Write LLM workflows that test themselves

https://newjerseystyle.github.io/FSM-agent-flow/
1•npc0•12m ago•0 comments