8 ms·
The Public Domain C Library
- ryanmccullagh 10y agoThis site seems to be broken. Clicking on Source link doesn't work.
- userbinator 10y agoWorks for me; it takes me to https://bitbucket.org/pdclib/pdclib https://bitbucket.org/pdclib/pdclib
- amadeusw 10y agoDoes it work for you further along? I wanted to peek at source or man of strlen and saw a 404: http://pdclib.e43.eu/man/#/man/3/strlen.html http://pdclib.e43.eu/man/#/man/3/strlen.html
- shakna 10y agoSome of the documentation is incomplete, and is based off the man files provided in the source's man3 folder. strlen is missing, but strdup isn't. http://pdclib.e43.eu/man/#/man/3/strdup.html http://pdclib.e43.eu/man/#/man/3/strdup.html Edit: And the source for strlen: [0] [0] https://bitbucket.org/pdclib/pdclib/src/95be959efe2ed2f36104ab5cffe9c222972d3e43/functions/string/strlen.c?at=default&fileviewer=file-view-default https://bitbucket.org/pdclib/pdclib/src/95be959efe2ed2f36104...
- easytiger 10y agoit loads the page, then reloads to a 404 page
- deleted 10y ago[deleted]
- ausjke 10y agowhat's the "selling point" here? don't we have quite a few c libraries(glibc, libc-bsd, musl, uclibc,...) already?
- loeg 10y agoExtremely liberal licensing is the only one I see. And BSD libc is pretty similar.
- shakna 10y agoI believe the licensing: public domain. It sparked my interest.
- systmkor 10y agoAt a glance it appears to be a difference without a distinction. What's legally or ethically gained by comparison to existing MIT/BSD licensed c libraries?
- shakna 10y agoLegally, there's less overhead for disseminating copyright notices, and how that should look based on how you're using the software. Ethically, there's no freer software than public domain. For myself, it makes it simpler to look into lifting out parts of the library to complement where avr-libc is lacking, which is in a lot of places. I don't have to worry over the fine line, a single line of attribution in the documentation of the final hardware device is more than is asked for. As to if I used something BSD licensed instead? If the license is somehow included with the software, well, the end user would never be able to see it, as it would be stored in EEPROM, and take about half the memory. Strings are a pain in the butt for memory management, and having a pop-up of some sort with the BSD license, would use about a third of available memory. Should it then be included in the documentation? Possibly, but included a no-warranty clause amongst documents for a warranty-covered device is likely to cause some strife amongst the purchasers of said device. Including it only in online documentation doesn't seem to fit either the letter or the spirit of the license. Practically, and legally, where to include the LICENSE is hard to tell. But I don't have to hire a lawyer with this. I can just use it.
- speeder 10y agoDo someone know how easy is to use this in your project without recompiling the OS and whatnot? I really want some good threads.h implementation, but musl is Linux-only, and the others I found so far are kinda hacky and have some problems here and there. (usually messing up your #defines and #includes in unexpected ways).
- shakna 10y agoThis still doesn't have great support for Windows, if that's what you're hoping. Mostly to do with MSVC's odd approach to C99, that having it is nice, but not a goal, so not all supplied functions strictly conform to the standard.
- pjmlp 10y agoThe approach is not odd at all. The future of Windows systems programming is C++ and C support in Visual C++ is only done to the extent required by ANSI C++ compliance. And ANSI C++ doesn't require C++ compilers to be C compilers, just to compile the common subset and libraries. For pure C projects there is the new integration of clang with VC++ backend, or any other C compiler capable of targeting Windows.
- shakna 10y agoThe clang integration was announced in 2015, so a full 16 years after C99 was finalised. A C compiler ignoring most of the spec for at least decade seems hugely odd to me. First and foremost, MSVC is a C compiler, and for a long time was the only one available. Comparing it's spec support story with GCC, clang, tcc or turboc, and it stands out. I mean, avr-gcc is designed mostly for use with C++, you're expected to use C++. But it still fully supports C99 and most of C11, with a goal to fix that in the next three years. It's... Odd. It may make sense if MS assumes all their developers have no need of the many C APIs they maintain, but it is certainly not the reasoning of many other compilers.
- pjmlp 10y ago
- Sir_Cmpwn 10y agoI've found this library to be a great resource for getting implementations of a bunch of simple functions with no strings attached. PDCLib code has made it into most of my toy kernels and the KnightOS libc.
- shakna 10y agoFantastic work on KnightOS! It has been a constant source of teachers complaining to me at school, because students are hacking away building programs to do all their work for them. I couldn't be happier.
- Sir_Cmpwn 10y agoThat's awesome! You wouldn't believe how much trouble I caused for my teachers in high school, especially the math teachers :)
- vidarh 10y agoYou're not a good student if you never cause trouble for your teachers. The problem is it takes a good teacher to distinguish between good trouble indicating an engaged student having fun with the material (e.g. a class mate of mine and I went through a phase of handing in homework in non-latin scripts; to our teachers great credit she tolerated Cyrillic, Etruskan and Sanskrit without the slightest complaint) and bad trouble.
- shakna 10y agoMy high school science teacher took it as I was bored, and gave me open-ended research questions to occupy me. e.g. Why is the sky blue during the day, and red at sunset? Though that's much easier to answer today, it taught me some great skills, and how to not be afraid of failure or rejection. I ended up having some great conversations with the professors at my local universities.
- vidarh 10y ago
- kchauhan 10y agoLooks like more code here for abs.c https://bitbucket.org/pdclib/pdclib/src/95be959efe2ed2f36104ab5cffe9c222972d3e43/functions/stdlib/abs.c?at=default&fileviewer=file-view-default https://bitbucket.org/pdclib/pdclib/src/95be959efe2ed2f36104... than musl: https://git.musl-libc.org/cgit/musl/tree/src/stdlib/abs.c https://git.musl-libc.org/cgit/musl/tree/src/stdlib/abs.c
- anilgulecha 10y agoBecause it includes testcases.
- therein 10y agoYou're absolutely 100% correct but to play the devil's advocate, what if he is talking about it being glibc: > return ( j >= 0 ) ? j : -j; Musl: > return a>0 ? a : -a;
- reidrac 10y agoIt really doesn't matter, the compiler will generate the same code (gcc -S at least does generate the same assembler output for both pieces of code; see: https://gist.github.com/reidrac/afb89b29228a243954bd51281c39ee88 https://gist.github.com/reidrac/afb89b29228a243954bd51281c39...). I guess looking at the definition: https://en.wikipedia.org/wiki/Absolute_value#Real_numbers https://en.wikipedia.org/wiki/Absolute_value#Real_numbers I would say `( j >= 0 ) ? j : -j` is more accurate, although in practical terms is the same result.
- tonetheman 10y agoThis stuff is beautiful.
- ksherlock 10y agoThis is C, not POSIX. POSIX defers to ISO C but has extensions and more strictly defined behavior/return values. Example (first function I randomly looked at) remove() - PDCLib won't remove directories or currently fopened files. ISO C doesn't mention directory support and removing an open file is implementation defined. POSIX says it is equivalent to unlink() or removdir() as appropriate.