I wouldn't have thought to look, but I saw something about xmake the other day (by the same people). I still am probably going to stick with cmake (inertia), but cool stuff.
I see "Micro: compiling micro library (~64K) for the embed system", now that caught my attention!
Should I then assume that the compatible platforms are actually more than the listed Windows, Linux, Mac, and mobile OSes?
I'm on the front of AVR development, and cool new things always arrive late (understandably, if they arrive at all...) to our little corner of the world :(
But I assume that "embedded" here will mean mainly ARM.
(similarly, I'm still excitedly waiting for more progress on the Rust front :)
You've been heavily downvoted because you made a category error. GlibC, musl, and uclibc are implementations of the c standard library[1]. Glib[2], this, and NSPR[3] (among others), on the other hand, abstract away platform-specific things. So whereas strcpy is a standard function that you can count on being there, the process for opening a window is different on windows, mac (quartz), mac (cocoa), unix (x11), unix (wayland), and others; the cross-platform libraries handle this and provide you with a single api for (for example) opening a window.
Now, as a language developer, you actually don't have to worry about any of these. The c standard library will be provided by the os and you don't have to think about it. Some programming languages that want to replace c don't rely on the c standard library, but you shouldn't have to worry about that. As for abstracting out different platform apis, I would say that doesn't really belong in your language itself.
To solve the problem in a robust way, the C library has to be part of the target. For example on Debian Linux, glibc is the native libc. On Alpine Linux, musl is the native libc. In LLVM terminology, this is the "C ABI environment" part of the "target triple".
If your compiler supports cross compiling, you might look into the strategies that Zig does[1]. If it only supports native builds, you probably want to detect the native libc. Again here it might be useful to look at what Zig does[2].
I haven't got this plan yet., but the tbox has a lightweight and compact libc implementation built in. The interface name looks like this: tb_snprintf, tb_strlcpy, ...
> Should I use this? (Or should I use glib, musl, or uclib?)
I agree that a comparison would be good, but musl and glibc are low level fundamental API's for things like printf and opening files.
Glib and this are higher level libraries to build applications with. If you're building a compiler you probably want one of these, for the generated code it would depend a lot on the specifics.
Edit - I'll also add that a lot of people's experience with C seems to com from college or beginner material where they're learning in a very bare bones environment. Combine C and libraries like this and it's not just good for app development but can be great for scripting where python or bash would typically be used.
What grammar restrictions? I've converted a few C99 libraries to C89 (since i prefer that one and i often work with older compilers because they are faster) and 99% of the time the reason a library uses C99 is inline variable declaration (which IMO is a bad style, but that is subjective) and // comments (which most C89 compilers support as an extension anyway).
The versions do have other differences, of course, but they're rarely used (the next most common one is designated initializers, which for me are the most annoying to convert).
I mean, it is your code, i just found the grammar restrictions part weird since really there isn't that much of a practical difference between C99 and C89 to the point i personally never felt the need to use C99.
(note that i focus on the language bits, C99 provides some extra library functionality but even then the most useful part is stdint.h which can be implemented in almost any C89 compiler anyway)
Yes, that is what i meant with "inline variables". IMO this is usually a sign of code that is too long to be readable and if you really need that you should either split the function to make it more readable or, if that cannot be done, enclose the affected code in their own brackets (with a comment that makes it easy to distinguish). Brackets also make sure that the variable wont "outlive" its context (although again that is a sign of code that is too long).
Of course that is my opinion (and i'm generalizing of course), but that comes from my experience with working with others' code.
some would say that C itself is obsolete.. Ok, I can hear a bunch of people already piping up and whining how they're programming on a 8-bit toaster and only have a C compiler..but apart from that there are no real reasons to use C anymore since it's obsolete.
Why does the no heap requirement preclude C++? Obviously, you couldn't use much of the STL (not really a loss in constrained environments), but I don't see a reason to write off the language itself?
If you think about radix tries and other data structures (AVL) it would be useful to be able to code good x>y tests against the binary state of IPv6. If you have to segment into two u_64 then shift-and-mask stuff becomes harder. So, purely for IPv6 (and I work with internet addresses a lot so my bias is showing) I think this makes sense.
But I totally get it may not be in your use case or first pass. Tiny home router builds? they'd want this. Anything doing IPv6 packet work testing or finding IPs in a structure will want this unless people code to the /64 model.
> I'm seeing tests anywhere. Am I blind or are they hidden away or non-existent? Thx in advance.
While this might be a valid point, I really don't like the manner in which it is expressed. Feigned surprise, pretend humility and, most importantly, lack of basic respect towards fellow developer(s).
Wait, you cited my text and changed it from the original dropping a key word and then attacked me for it. Not cool. There is no feigned surprise or lack of respect either implied or actually present in my inquiry about the lack of tests.
So your colleagues all created accounts between forty and seventy minutes ago to make positive comments (except for one account that's existed for two years, but has only ever commented on this guy's stuff)?
Even if this is the case, that's arguably just as much of a voting ring as bots.
The project has been around for 10 years and has almost 2500 stars on Github. The creator is Chinese but working in English as a courtesy and has used this body of code to create a number of fascinating projects, including an x86 emulator.
What have you given to the programming world lately?
EDIT: it was pointed out that this last comment was abusive. Sorry about that.
Good for him. I haven't known how to program very much for very long, and am a student, but so what? Am I not allowed to mention someone breaking rules? If you look above, I gave credit where credit was due, and only mentioned this near the bottom as a reply to a relevant comment. Quit white-knighting; I'm sure the author can defend himself.
I'm sure the intentions were good, but this is outside what the community considers polite behavior. The FAQ mentions this about voting: https://news.ycombinator.com/newsfaq.html.
If users aren't posting qua community members then the expectation is to provide a disclaimer.
I wouldn't have thought to look, but I saw something about xmake the other day (by the same people). I still am probably going to stick with cmake (inertia), but cool stuff.