Sili - a cross-platform standard library for modern C programming
Sili is a cross-platform standard library for modern C99 programming, providing
many new features, improvements and fixes to the language’s standard libraries,
while still adhering to the main principles and appeals of C.
The project aims to modernize C by implementing a proper standard library that is
more feature-rich and understandable to read and write, while also containing a
lot of quality of life changes for better readability and safety. It serves
as a lighter alternative to the bloated C++ STL.
Sili strives to strike a balance between having great performance and flexibility
that provide many options for developers when using the library.
sili.h
is a single-header library, allowing for easy integration into any project.
Furthermore, sili is designed to be cross-platform, supporting any OS that has a
working C99 compiler.
SI_CPU_X86
,SI_SYSTEM_WINDOWS
, SI_COMPILER_CLANG
, SI_STANDARD_C99
, SI_STANDARD_ANSI
typeof()
, SI_ASSERT
/SI_STATIC_ASSERT
, SI_BIT
, foreach
etc).siString
, fully compatible with char*
).siArray(<type>)
, compatible with other C arrays).char
specific functions (si_charToLower
, si_charIsSpace
, si_hexDigitToInt
etc).si_hashtableMakeReserve
, si_hashtableGetWithHash
, si_hashtableSet
)si_pathExists
, si_pathCopy
, si_pathGetFullname
etc).si_fileOpen
, si_fileReadContents
,si_fileWriteLineAt
etc).siOptional
type similar to std::optional
.si_threadCreate
, si_threadStart
, si_threadJoin
).si_benchmarkRunsPerLoop
,si_benchmarkExecutesPerMs
, si_benchmarkLoopsAvg
etc).malloc
/free
.si_utf8Decode
, si_utf8ToUtf16String
, si_utf16ToUtf8String
).si_numCountBitsU32
, si_numRotateLeft
, si_bytesToNumArr
,SI_NUM_BIT_SET
etc).si_dllLoad
, si_dllProcAddress
).printf
implementation, which includes C23 and new specifiers, as well%ll
and %l
both equal to i64
).Examples of most (but definitely not all) sili’s features are utilized in the
examples
folder.