Sane Coding Blog Notes on Sane C++ Libraries and practical systems work.

๐Ÿ–๏ธ Sane C++ July 25

Welcome to the update post for July 2025! It's dependency cleanup month! ๐Ÿงน๐Ÿงน๐Ÿงน

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 this reason from this month I've started publishing:

  • The reported lines of code (LOC) for each library
  • The dependencies between libraries

An automatic python scripts now updates both inside each library documentation page and also to Readmes and elsewhere.

This has been the input to start attacking and removing un-needed inter-dependencies between libraries.

This has in turn freed many libraries from dynamic allocation!

Detailed list of commits:

Foundation cleanup

The Foundation library received several updates in order to make it as minimal as possible.

  • StringViewData was renamed to StringSpan for better clarity.
  • A new StringPath class was introduced to handle file system paths with maximum length constraints and UTF-16 conversion.
  • Rarely used methods in Span<T> were moved to where they are actually used, and some unused TypeTraits were removed.
  • Backtrace printing for Assert was implemented on Windows.
  • Some classes have been moved elsewhere (like Limits.h).

All of these building blocks have been necessary to allow removal of several inter-dependencies between libraries in the project.

Dynamic allocation status: No allocation

Detailed list of commits:

Async dependencies

Async is an advanced multi-platform async IO library with a feature set that is progressively expanding.

The biggest library of the project has now no more dependency on Process library. Combining this with all the other dependency cleanups of this month makes the library set of transitive dependencies much cleaner.

Previously the SC::Async Library was depending on almost the entire rest of Sane C++ Libraries!

Now the entire list of dependencies for Async is File, FileSystem, Foundation, Socket, Threading, Time.

Dynamic allocation status: No allocation

Detailed list of commits:

FileSystemWatcher Dependencies

FileSystemWatcher has probably been the hardest dependency cleanup to finish.

In addition to removing dependencies from Strings and Memory libraries, it has been necessary to remove dependency from the Async library too. The reason is that FileSystemWatcher supports both a thread based backend or an event loop based one.

Now the role of integrating FileSystemWatcher with Async has been isolated in the FileSystemWatcherAsync library, through some minimal runtime virtual interface usage.

Dynamic allocation status: No allocation

Detailed list of commits:

FileSystem Dependencies

The FileSystem library underwent significant refactoring to simplify its code and reduce dependencies:

  • Platform-specific implementations were merged into FileSystemOperations.
  • Methods like makeDirectoryRecursive were added, while removeEmptyDirectoryRecursive was removed.
  • Dependencies on Containers, Strings, and Memory libraries were eliminated, making the library more lightweight and focused.

Library now only depends on Foundation and Time libraries.

Dynamic allocation status: No allocation

Detailed list of commits:

FileSystemIterator dependencies

FileSystemIterator has been already cleaned up during path month's effort. This month however the extremely error prone manual string handling has been reduced through the use of the new StringPath class

Library now only depends on Foundation library.

Dynamic allocation status: No allocation

Detailed list of commits:

File dependencies

File has also seen removal of dependencies from Memory and Strings, by using StringPath for simplifying string handling.

Library now only depends on Foundation library.

Dynamic allocation status: No allocation

Detailed list of commits:

Process dependencies

The Process library has seen also dependency from Strings and Memory library removed, through some lightweight runtime abstraction (IGrowableBuffer). This interface abstracts read/write operation to/from Strings and Buffers.

Library now only depends on File and Foundation libraries.

Dynamic allocation status: No allocation

Detailed list of commits:

Socket dependencies

The Socket libraries has been streamlined by removing dependencies on Strings, File, Threading and Time.

Library now only depends on Foundation.

Dynamic allocation status: No allocation

Detailed list of commits:

Strings improvements

The Strings library saw several improvements:

  • StringNative was renamed to SmallStringNative.
  • Path functionality was moved from the FileSystem library to Strings.
  • StringConverter was updated to accept StringSpan.

Dynamic allocation status: Allocates dynamic memory

Detailed list of commits:

Other improvements

  • The CI pipeline was updated to replace Windows Server 2019 with Windows Server 2025.
  • Code was cleaned up to remove warnings reported by clangd
  • Debug Visualizers have been fixed

Detailed list of commits: