Oh thank you, that cpu_detect.c3 is exactly what I need, the posted single-header library is almost the same in terms of functionality.
BTW my last question still stands, however, that if there is a C library that is only a single header file that implements functions through macros, can it be used from C3? In C, for what I posted, you would need to first do "#define CPUDETECT_IMPL" and then include the header file. Could it be done from C3 somehow? As in, could this (or any) single-header library be used from C3?
And regarding the errors, can I have something like "Error" (in Odin), or an enum of errors? Sorry for this silly question, I realize I will have to read the source code of the libraries first.
Thank you for your help!
It is possible to use a single-header library as part of C3 libraries or your project. However, it must be noted that this will inhibit the ability to cross compile, as the compilation of the header is outsourced to the natively installed C compiler.
For that reason it's not an option for the standard library, but can certainly be useful for programs and libraries.
For faults, they are usually defined with `faultdef` which allows you to define one or more faults:
Then you use them as if they were constants: If they are defined in another module, say "foo::bar::baz", then: Using path shortening "foo::bar::baz::BIG_OOPS" would also be valid, but is not necessary nor recommended.Thank you!
Is it possible to do something like:
or something like that?Does C3 have a way to generate documentation?
You could do
There are third party tools to generate docs. You can also get some json output from the c3 compiler itself to base docs on