grace/lilac
An Experimental C Library using modern features
git clone https://git.gae.moe/grace/lilac
f3dea09
main
lilac.h notes
Defer
This uses the C29 proposal for _Defer. It is using clang specifically.
#link("https://www.mail-archive.com/gcc-patches@gcc.gnu.org/msg424010.html")#link("https://gustedt.wordpress.com/2026/02/15/defer-available-in-gcc-and-clang/")
_Nonnull and _Nullable
This doesn't seem to work great with all existing c stuff right now but there is some hope for the future.
#link("https://github.com/llvm/llvm-project/pull/189131")[PR to clang with ability to default to assuming nonnull]#link("https://cs01.github.io/llvm-project/?nullability=unspecified")[Playground for testing nullibility things with that pr]
List (to implement)
I think you could do something interesting like defining a macro to create list functions for a type.
create_list_functions ( i32 ) ; i32 main ( void ) { // I dont think you can do this in c without macros. macros are fine tho list_i32 * list = list_make ( i32 ) ; list_add ( list , 5 ) ; }
create_list_functions could create types and function based on the type you give it. then it uses clangs overridable attribute to make generic functions.
Things to look at
#link("https://clang.llvm.org/docs/LanguageExtensions.html#overflow-behavior-types")#link("https://stackoverflow.com/questions/3430315/what-is-the-purpose-of-static-keyword-in-array-parameter-of-function-like-char")#link("https://clang.llvm.org/docs/MatrixTypes.html")
1= lilac.h notes 2 3== Defer 4 5This uses the C29 proposal for`_Defer` . It is using clang specifically. 6 7- # link ( "https://www.mail-archive.com/gcc-patches@gcc.gnu.org/msg424010.html" ) 8- # link ( "https://gustedt.wordpress.com/2026/02/15/defer-available-in-gcc-and-clang/" ) 9 10== `_Nonnull` and `_Nullable` 11 12This doesn' t seem to work great with all existing c stuff right now but there is some hope for the future. 13 14- # link ( "https://github.com/llvm/llvm-project/pull/189131" )[ PR to clang with ability to default to assuming nonnull] 15- # link ( "https://cs01.github.io/llvm-project/?nullability=unspecified" )[ Playground for testing nullibility things with that pr] 16 17 18== List (to implement) 19 20I think you could do something interesting like defining a macro to create list functions for a type. 21 22``` c 23create_list_functions ( i32 ) ; 24 25i32 main ( void ) { 26// I dont think you can do this in c without macros. macros are fine tho 27list_i32 * list = list_make ( i32 ) ; 28list_add ( list , 5 ) ; 29} 30``` 31 32`create_list_functions` could create types and function based on the type you give it. then it uses clangs`overridable` attribute to make generic functions. 33 34 35 36== Things to look at 37- # link ( "https://clang.llvm.org/docs/LanguageExtensions.html#overflow-behavior-types" ) 38- # link ( "https://stackoverflow.com/questions/3430315/what-is-the-purpose-of-static-keyword-in-array-parameter-of-function-like-char" ) 39- # link ( "https://clang.llvm.org/docs/MatrixTypes.html" ) 40 41