Stefano Cristiano's Avatar

Stefano Cristiano

@pagghiu.bsky.social

Principal Research Scientist@NVIDIA (Omniverse Physics) Author of "Sane C++ Libraries" https://github.com/Pagghiu/SaneCppLibraries Videos: https://youtube.com/@Pagghiu Site: https://pagghiu.github.io Opinions are my own.

128 Followers  |  85 Following  |  142 Posts  |  Joined: 20.10.2024  |  1.7069

Latest posts by pagghiu.bsky.social on Bluesky

Sane C++ Libraries Dependencies (October 2025)

Sane C++ Libraries Dependencies (October 2025)

Sane C++ Libraries - October 2025

✅ Further reduction of internal dependencies
✅ Bring Your Own Containers example (InteropSTL)
✅ New bootstrap for SC::Tools written in C++
✅ Increased test coverage
✅ Improved CI
✅ Fixes

github.com/Pagghiu/Sane...
#cpp #cplusplus

01.11.2025 10:40 — 👍 2    🔁 0    💬 0    📌 0
Preview
InteropSTL: Show std::string and std::vector<char> usage with File an… · Pagghiu/SaneCppLibraries@cb8bca4 …d FileSystem libraries

Sane C++ Libraries has finally become a BYOC (Bring Your Own Containers) project!
We have SC::Strings and SC::Vector<T>, using relative pointers and a "scoped" allocator logic that not everyone may like, but you can now write adapters to use something else

26.10.2025 07:59 — 👍 1    🔁 0    💬 0    📌 0
A drawing showing current state of dependencies between Sane C++ Libraries

A drawing showing current state of dependencies between Sane C++ Libraries

Sane C++ Libraries - September 2025

✅Get rid of many inter-library dependencies
✅Stop accidental dependencies additions in CI
✅Free most libraries from dynamic allocation
✅Transform Build from lib to app
✅Add GDB Pretty Printer
✅Many smaller fixes

github.com/Pagghiu/Sane...

#cpp #cplusplus

30.09.2025 22:31 — 👍 1    🔁 0    💬 0    📌 0
Picture of the pretty printers being registered by the new GDB debug visualizer script for Sane C++ Libraries

Picture of the pretty printers being registered by the new GDB debug visualizer script for Sane C++ Libraries

I've been adding to Sane C++ Libraries a GDB debug visualizer (pretty printer in gdb terminology) taking care of strings and containers.

In addition to the already existing ones for LLDB and MSVC Debugger (.natvis) I think we should be good now!
#cpp #cplusplus

05.09.2025 19:19 — 👍 0    🔁 0    💬 0    📌 0
Preview
Release 2025-08 · Pagghiu/SaneCppLibraries August 2025 Update Blog Post Single File Libraries One of the core principles of this project is to be "Easy to Integrate". I'm always looking for ways to lower the barrier to entry for using these...

Sane C++ Libraries - August 2025

✅ Available as Single File Libs
✅ Threading: Semaphore / Barrier / RWLock (→ Stable)
✅ AsyncStreams: IPC Pipe Streams (→ MVP)
✅ Process: Improve reliability
✅ More fixes (see blog post details)

pagghiu.github.io/site/blog/2025-08-31-SaneCppLibrariesUpdate.html
#cpp

31.08.2025 08:35 — 👍 0    🔁 0    💬 0    📌 0

Of course I would only vibe-code Sane C++ Libraries!

30.08.2025 21:46 — 👍 0    🔁 0    💬 0    📌 0
Screenshot of the Sane C++ Libraries Amalgamation tool, allowing to amalgamate libraries directly in browser.

Screenshot of the Sane C++ Libraries Amalgamation tool, allowing to amalgamate libraries directly in browser.

Screenshot of one example amalgamated single file lib (SaneCppFileSystem.h) showing the initial header section with LOC count for header vs. implementation, explicit list of dependencies, copyright etc.

Screenshot of one example amalgamated single file lib (SaneCppFileSystem.h) showing the initial header section with LOC count for header vs. implementation, explicit list of dependencies, copyright etc.

Sane C++ Libraries are now available as amalgamated single-file libs!

They can be amalgamated offline or directly in-browser at: pagghiu.github.io/SaneCppLibra...

Each amalgamation lists dependencies on other amalgamated libs and the LOC of its header vs. implementation sections.

Have fun!
#cpp

11.08.2025 13:50 — 👍 0    🔁 0    💬 0    📌 0
Preview
Release 2025-07 · Pagghiu/SaneCppLibraries July 2025 Update Blog Post Automatic Dependency and LOC List of dependencies between libraries and the number of lines of code (LOC) composing them gives an immediate complexity indication. For thi...

Sane C++ Libraries - July 2025

Major cleanup month!🧹

✅ Massive reduction in inter-library dependencies
✅ 7 libraries now allocation-free:
- Async
- File
- FileSystem
- FileSystemIterator
- FileSystemWatcher
- Process
- Socket

pagghiu.github.io/site/blog/2025-07-31-SaneCppLibrariesUpdate.html
#cpp

01.08.2025 21:21 — 👍 0    🔁 0    💬 0    📌 0
Preview
FileSystemWatcher: Remove dependency from Async and File libraries · Pagghiu/SaneCppLibraries@563c03e

I have been removing the dependency of the Sane C++ FileSystemWatcher library from the Async one.
There's a new mini-lib now called FileSystemWatcherAsync wiring them together explicitly when event loops are needed.
It feels so much cleaner now!

github.com/Pagghiu/Sane...

28.07.2025 20:58 — 👍 0    🔁 0    💬 0    📌 0

I wonder if I should capitalize on this by distributing them as isolated single file libraries...

23.07.2025 20:21 — 👍 0    🔁 0    💬 0    📌 0
Post image

I have been removing many inter-dependencies between Sane C++ "Libraries" (mainly Strings/Memory/Containers)

The following libraries do not allocate anymore! 🎉

✅ Async
✅ File
✅ FileSystem
✅ FileSystemWatcher
✅ FileSystemIterator
✅ Process
✅ Socket

See: pagghiu.github.io/SaneCppLibra...

#cpp

23.07.2025 20:21 — 👍 0    🔁 0    💬 1    📌 0
Preview
Release 2025-06 · Pagghiu/SaneCppLibraries June 2025 Update Blog Post Async File System Operations A major new feature this month is the unified AsyncFileSystemOperation that provides async file system operations across all platforms. This ...

Sane C++ Libraries June 2025:

✅ Async FS Ops
- {copy|remove|rename}{file|folder}
- {open|close|read|write}file
✅ AsyncUDP {SendTo | ReceiveFrom}
✅ FileSystem {Iterator | Watcher} / Memory dependencies cleanup

Blog
pagghiu.github.io/site/blog/20...

Github
github.com/Pagghiu/Sane...
#cpp #cplusplus

30.06.2025 22:02 — 👍 2    🔁 0    💬 0    📌 0

This week I have been adding a few more obvious Async FileSystem Ops:

✅ file/directory rename
✅ file/directory remove

pagghiu.github.io/SaneCppLibra...

#cpp #cplusplus

28.06.2025 08:58 — 👍 2    🔁 0    💬 0    📌 0
Sane C++ Libraries: Async

Async FileSystem Operation has been added to Sane C++ Libraries for:

✅file open/close
✅file read/write
✅file copy

All ops are executed on user supplied thread-pool for IOCP(win)/kqueue(mac)/epoll(linux), with special code path for io_uring(linux)!

pagghiu.github.io/SaneCppLibra...
#cpp #cplusplus

21.06.2025 15:11 — 👍 2    🔁 0    💬 0    📌 1
Post image Post image

I have been adding to Sane C++ Libraries some async primitives needed to send and receive bytes to and from UDP sockets (sendTo and receiveFrom).

As always implemented for IOCP, kqueue / epoll and io_uring!

Documentation:
pagghiu.github.io/SaneCppLibra...

Commit:
github.com/Pagghiu/Sane...

#cpp

11.06.2025 20:25 — 👍 0    🔁 0    💬 0    📌 0
Pagghiu/SaneCppLibraries | DeepWiki The Sane C++ Libraries project provides a comprehensive set of platform abstraction libraries for macOS, Windows, and Linux. This documentation covers the architecture, components, and integration app

Sane C++ Libraries May 2025:

✅ AsyncSequence
- Serial execution of async requests
✅ SC::Async
- Smaller memory footprint
- Improved cancellation handling

deepwiki.com/Pagghiu/Sane...

Blog:
pagghiu.github.io/site/blog/20...

Github:
github.com/Pagghiu/Sane...

Have a nice weekend!
#cpp #cplusplus

31.05.2025 08:59 — 👍 1    🔁 0    💬 0    📌 0
Preview
Release 2025-04 · Pagghiu/SaneCppLibraries April 2025 Update Blog Post Process SC::Process library allows spawning process across all supported platforms with many features, including I/O redirection and setting environment variables / star...

Sane C++ Libraries April 2025

✅ Process fork
✅ Struct dumping
✅ Async vectorized writes
✅ Tools update
✅ Repo restructuring

Blog:
pagghiu.github.io/site/blog/2025-04-30-SaneCppLibrariesUpdate.html

Github:
github.com/Pagghiu/SaneCppLibraries/releases/tag/release%2F2025%2F04

Have a nice week!
#cpp

30.04.2025 22:10 — 👍 2    🔁 0    💬 0    📌 0
Post image

I've added a ProcessFork class to Sane C++ Libraries after discovering that "fork" on Windows can be approximated with RtlCloneUserProcess.
There are a ton of limitations but it's useful to serialize a data structure without blocking for IO or copying it for async IO.
Nice!
#cpp

12.04.2025 06:49 — 👍 0    🔁 0    💬 0    📌 0

std::launder is so 2024

05.04.2025 11:07 — 👍 1    🔁 0    💬 0    📌 0
Post image

An example of "struct dumping" in Sane C++ Libraries.
Anything SC::Segment based (Vector / String / VectorMap etc.) can be dumped and restored by just casting it (well, start_lifetime_as 🤭).
I guess it's not rocket science but recent additions make creating this simple and easy.
#cpp #cplusplus

05.04.2025 07:06 — 👍 2    🔁 0    💬 1    📌 0
Sane Coding Blog - ☔️ Sane C++ March 25 Sane Coding Blog

Sane C++ Libraries improvements for March 2025:

✅ Custom Allocators (Segment / Containers)
✅ Relative Pointers

Blog:
pagghiu.github.io/site/blog/2025-03-31-SaneCppLibrariesUpdate.html

Github:
github.com/Pagghiu/SaneCppLibraries/releases/tag/release%2F2025%2F03

Have a nice week!
#cpp #cplusplus

31.03.2025 20:19 — 👍 1    🔁 0    💬 0    📌 0

This is going to be hard!

Fun fact: I was just incidentally thinking right now about using thread_local static to store a memory allocator.

18.03.2025 21:46 — 👍 1    🔁 0    💬 0    📌 0
Post image

While debugging some of the recent container issues for Sane C++ Libraries I have been starting to track the number of allocation and deallocations calls.

The test suite by itself is doing 20K allocations and ~50K re-allocations 🫠.

Is it MAYBE time to add support for custom allocators? 😅

18.03.2025 21:43 — 👍 0    🔁 0    💬 0    📌 0
Post image

I have been slapping volatile where I think it makes sense to force the optimizer think twice about making weird assumptions around that code.
Hopefully this will not be so bad performance wise.
I could maybe replace that offset == 0 conditional with some branchless code to improve things further...

17.03.2025 23:14 — 👍 0    🔁 0    💬 0    📌 0
Preview
Foundation: Refactor Segment to reduce and isolate UB · Pagghiu/SaneCppLibraries@7a97c14

I've been pushing one more refactoring for Sane C++ Libraries Containers (never enough!) to take advantage of all of my recently acquired know-how on fighting UB connected to violating compiler aliasing analysis...or at least isolate it!

Hopefully this is now better than before 🧹
#cpp #cplusplus

17.03.2025 23:00 — 👍 1    🔁 0    💬 1    📌 0
Mapping Address Independent Pointer: offset_ptr - 1.87.0

Ok I was just told on the Italian C++ Discord about a presentation that linked to boost::interprocess::offset_ptr
www.boost.org/doc/libs/1_8...
Looking at the code it just seems to slap const volatile everywhere and be happy with that 😅
www.boost.org/doc/libs/1_8...
Can we consider Boost UB free? 🤭

14.03.2025 10:29 — 👍 0    🔁 0    💬 0    📌 0

yeah, the thing is you may never hit specific UB manifestation until maybe someday with some compiler / platform combination after modifying some unrelated code or with a specific runtime workload.
That's why UB are so bad, and in C++ it's too easy hitting one of the many defined by the standard 😮‍💨

13.03.2025 19:53 — 👍 0    🔁 0    💬 0    📌 0
Post image

Most SSO implementations I have seen use an union of pointer+size and the buffer. They discriminate the union depending on value of capacity (if > than buffer array size then you’re on the heap and viceversa).
There is no pointer arithmetic in this case, correct.

13.03.2025 10:30 — 👍 1    🔁 0    💬 2    📌 0

that is exactly what you wrote @jeremy.laumon.name , sorry I was reading your message too quickly 😅

13.03.2025 08:48 — 👍 1    🔁 0    💬 0    📌 0

Well I just replied to myself in another post, that the issue is not only that on some platform such equivalences do not hold, but that once declared UB, compiler writers started to use them for very obscure optimizations breaking your code anyway even on platforms where equivalences would be valid.

13.03.2025 08:47 — 👍 1    🔁 0    💬 1    📌 0

@pagghiu is following 20 prominent accounts