frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Lib0xc: A set of C standard library-adjacent APIs for safer systems programming

https://github.com/microsoft/lib0xc
28•wooster•3h ago

Comments

platinumrad•3h ago
I truly hope something like this catches on. There is so much low hanging fruit in both the C and C++ standard libraries. Spatial memory could be 90% solved in both languages by mandating the use of safe interfaces.
matheusmoreira•1h ago
Interesting. I'll be studying this later tonight so I can apply it to my C projects. Especially clang's -fbounds-safety.
atilimcetin•1h ago
The title looks very promising. I’ve added this library to my to-do list to take a deeper look at it. Using this standart library within restricted safe subset of C++ can be a strong opponent for Zig (at least for myself).
EPWN3D•23m ago
Haven't really verified that it works with C++, but I tried my best to guard the stuff I knew would be problematic with #if __cplusplus. Happy to have a PR that makes C++ happier with it.
atilimcetin•10m ago
Thanks for the reply. Noted :)
raggi•1h ago
there are no good reasons we don't do this in the standards themselves, C, C++, and POSIX should all be working on editions that add safer APIs and mark unsafe APIs as deprecated, to start a long term migration. we know how to do this, we've had a lot of success with this. there are real engineering concerns, sure, but they're not reasons to not do it. compilers and library chains can retain support for less safe variants for plenty of time.
zbentley•36m ago
There are only two kinds of standards: ones that prioritize stability and backwards compatibility over usefulness and security, and ones nobody uses.
AlotOfReading•34m ago
The reason this wasn't done by the standards committees is that they spent decades refusing to admit there was even a problem they could help fix. And if there was a problem, it was easily avoided by just writing better code. And if writing better code wasn't enough, well it was certainly too expensive to provide as a debug option. And if it wasn't too expensive to provide as a debug option, the implementors should really lead the way first. And on and on.

The C committee at least seems to get it now. The C++ committee still doesn't, led in large part by Bjarne.

nxobject•42m ago
I'm curious – is MSFT using this in production, or is this a "20% time" project? I'm not sure MSVC could compile the GNU extensions used.
EPWN3D•25m ago
Author here. It is not currently in production, but it is part of a project in Azure which will go to production at some point. I'm actually leaving Microsoft next week and fully intend to keep working on it if I can reach an agreement to do so with my new employer.
EPWN3D•21m ago
Author here, I posted this in Show HN but someone clearly beat me to it. So I'll repost my blurb from there.

Various patterns for safer C programming have been cargo-culting around the industry for decades. Because the language evolves intentionally slowly, these patterns rarely get folded into the language as first-class constructs and are passed down through the generations in a sort of oral tradition of programming.

lib0xc leverages GNUC extensions and C11 features to codify safer C practices and patterns into real APIs with real documentation and real testing. Reduce your casts to and from `void *` with the `context_t` tagged pointer type. Enable type-checked, deferred function invocation with `call_t`. Interrogate structure descriptors with `struct_field_t`. Stop ignoring `-Wint-conversion` and praying you won't regret it when you assign a signed integer to an unsigned integer and use `__cast_signed_unsigned`. These are just a few of lib0xc's standard-library-adjacent offerings.

lib0xc also provides a basic systems programming toolkit that includes logging, unit tests, a buffer object designed to deal with types, a unified Mach-O and ELF linker set, and more.

Everything in lib0xc works with clang's bounds-safety extensions if they are enabled. Both gcc and clang are supported. Porting to another environment is a relatively trivial effort.

It's not Rust, and it's not type safety, but it's not supposed to be. It's supposed to help you make your existing C codebase significantly safer than it was yesterday.

My employer holds the copyright and has permitted its release under the MIT license.

valorzard•4m ago
This might be a dumb question, but using this + clang bounds-safety, whats the difference between this and something like Zig or Odin.

What do you think C would need in order to reach the user experience of those languages?

jabl•18m ago
Unfortunate naming. I thought this was about https://libxc.gitlab.io/ but there's an extra '0' in the name here.

Ti-84 Evo

https://education.ti.com/en/products/calculators/graphing-calculators/ti-84-evo
129•thatxliner•2h ago•154 comments

Credit cards are vulnerable to brute force attacks

https://metin.nextc.org/posts/Credit_Cards_Are_Vulnerable_To_Brute_Force_Kind_Attacks.html
119•kodbraker•1h ago•99 comments

New research suggests people can communicate and practice skills while dreaming

https://www.newyorker.com/culture/annals-of-inquiry/its-possible-to-learn-in-our-sleep-should-we
149•XzetaU8•4h ago•81 comments

Show HN: Destiny – Claude Code's fortune Teller skill

https://github.com/xodn348/destiny
36•xodn348•2h ago•29 comments

Ask HN: Who is hiring? (May 2026)

199•whoishiring•7h ago•224 comments

The Smelly Baby Problem

https://www.worksinprogress.news/p/how-disposable-diapers-conquered
12•dionysou•2d ago•2 comments

Whimsical Animations Course Open House

https://courses.joshwcomeau.com/wham/open-house/00-introduction
39•SpyCoder77•2h ago•5 comments

SpaceX rocket set for unintentional Moon landing – well, a piece of it anyway

https://www.theregister.com/2026/05/01/spacex_debris_landing/
22•beardyw•10h ago•7 comments

whohas – Command-line utility for cross-distro, cross-repository package search

https://github.com/whohas/whohas
108•peter_d_sherman•7h ago•26 comments

City Learns Flock Accessed Cameras in Children's Gymnastics Room as a Sales Demo

https://www.404media.co/city-learns-flock-accessed-cameras-in-childrens-gymnastics-room-as-a-sale...
221•joshcsimmons•3h ago•56 comments

Lib0xc: A set of C standard library-adjacent APIs for safer systems programming

https://github.com/microsoft/lib0xc
28•wooster•3h ago•13 comments

AI uses less water than the public thinks

https://californiawaterblog.com/2026/04/26/ai-water-use-distractions-and-lessons-for-california/
284•hirpslop•5h ago•261 comments

Show HN: WhatCable, a tiny menu bar app for inspecting USB-C cables

https://github.com/darrylmorley/whatcable
366•sleepingNomad•13h ago•124 comments

Spotify adds 'Verified' badges to distinguish human artists from AI

https://www.bbc.com/news/articles/c5yerr4m1yno
169•reconnecting•5h ago•189 comments

Ask HN: Who wants to be hired? (May 2026)

106•whoishiring•7h ago•212 comments

Show HN: AI CAD Harness

https://fusion.adam.new/install
45•zachdive•4h ago•60 comments

Artemis II Fault Tolerance

https://alearningaday.blog/2026/05/01/artemis-ii-fault-tolerance/
42•speckx•4h ago•25 comments

Apocalypse Early Warning System

https://ews.kylemcdonald.net/
82•carlsborg•6h ago•42 comments

Sally McKee, who coined the term "the memory wall", has died

https://www.online-tribute.com/SallyMcKee
97•deater•7h ago•19 comments

Historic Tennessee Hotel Is Also Home to the Greatest Duck Tradition (2016)

https://www.audubon.org/magazine/tennessees-most-historic-hotel-also-home-greatest-duck-tradition
12•NaOH•2d ago•0 comments

Understand Anything

https://github.com/Lum1104/Understand-Anything
77•taubek•4h ago•24 comments

Eka’s robotic claw feels like we're approaching a ChatGPT moment

https://www.wired.com/story/when-robots-have-their-chatgpt-moment-remember-these-pincers/
50•zdw•1d ago•47 comments

The Gay Jailbreak Technique

https://github.com/Exocija/ZetaLib/blob/main/The%20Gay%20Jailbreak/The%20Gay%20Jailbreak.md
280•bobsmooth•5h ago•93 comments

Ubuntu servers taken offline by "sustained, cross-border attack"

https://arstechnica.com/security/2026/05/ubuntu-infrastructure-has-been-down-for-more-than-a-day/
72•RattlesnakeJake•3h ago•13 comments

I'm Peter Roberts, immigration attorney who does work for YC and startups. AMA

108•proberts•7h ago•171 comments

Running Adobe's 1991 PostScript Interpreter in the Browser

https://www.pagetable.com/?p=1854
111•ingve•10h ago•26 comments

Your website is not for you

https://websmith.studio/blog/your-website-is-not-for-you/
234•pumbaa•11h ago•171 comments

AWS stops billing Middle East cloud customers as repairs to war damage drag on

https://arstechnica.com/gadgets/2026/05/amazon-stuck-with-months-of-repairs-after-drone-strikes-o...
111•johnbarron•4h ago•43 comments

An open letter asking NHS England to keep its code open

https://keepthingsopen.com
196•tvararu•7h ago•12 comments

A Letter from Dijkstra on APL (1982)

https://www.jsoftware.com/papers/Dijkstra_Letter.htm
46•tosh•10h ago•45 comments