Writing C software without the standard library
61–70 of 188 posts
Re: Writing C software without the standard library
#62Your first paragraph makes me wish this site supported Markdown.
Re: Writing C software without the standard library
#63> Executables are incredibly small (the http mirror server for my gopherspace is powered by a 10kb executable). Is this ever an real issue, even on any embedded system in the last 20 years?
Re: Writing C software without the standard library
#64He claims that your code will be easy to port but then goes straight to Linux system calls. Still I like the idea. This is something that should be covered in a CS 102 type course. I know way to many cs guys who have no idea how to debug, let alone how their is being implemented.
Re: Writing C software without the standard library
#65Your first paragraph makes me wish this site supported Markdown.
Yeah off topic but if HN supported markdown (and GitHub's flavor of markdown so we could take different types of syntax with their language) would be amazing. There would be a ton more coding examples and discussion, in my opinion, if this were to happen. How do we summon Dang? :)
Re: Writing C software without the standard library
#66The comment section where gcc puts in ident info can be omitted with -fno-ident and syscall(2) is usually a very thin wrapper[0]. If you follow the musl syscall(2) it simply maps errors to errno[1] and uses the fancy count-args-in-macro[2] to call off the respective $arch/syscall_arch.h[3] syscall$n numbered functions. [0] https://git.musl-libc.org/cgit/musl/tree/src/misc/syscall.c [1] https://git.musl-libc.org/cgit/…
Highly recommend reading the Musl source code if you want to find out how things work. Don't bother trying to look at Glibc.
glibc's source feels like archeology: there's so much history and remnants of bygone eras.
musl feels like a structured, well-engineered and specified piece of architecture.
This isn't a knocj against glibc. But it was grown, not built.
musl and the team's great documentation have been incredibly handy when I've been building tightly constrained applications.
Re: Writing C software without the standard library
#67Earlier quoted context omitted.
True. The OS layer you write (and port to other OSes) is called "the standard library". :-)
A .h file with different syscalls IDs and perhaps a few inline functions is hardly a standard library though
That's not portable even across versions of the same OS, many OS don't support raw syscalls and don't make any guarantees about them. That's why you can't statically link libc on OSX for instance, libSystem is literally the system's interface and necessarily dynamically linked.
Re: Writing C software without the standard library
#68Re: Writing C software without the standard library
#69What is necessary to do this with C++? Is there a tutorial available on the web?
focused on windows, because grafix. also, linux guys are more likely to use C anyway.
I only remember a comment about avoiding exceptions, which I might have read first in the context of micro controllers.
https://www.google.de/search?q=site%3Apouet.net+c%2B%2B+exce...
https://www.google.de/search?q=site%3Apouet.net+c%2B%2B+stdl...