8 ms·
Tbox: A GLib-like cross-platform C library
- waruqi 8y agoProvides stream, container, iterator, algorithm, coroutine, database .. modules. And we use xmake to build it.
- honey1988 8y agoGreat!
- ray_xy 8y agoI like it
- linfeng315 8y agoVery Good! I like it!
- mengxianbo92 8y agonice,good job
- itfanr 8y agoVery Good! I like it!
- mlindner 8y agoWhy was it written in C instead of Rust/C++? Additionally why are there a bunch of generic sounding Chinese names in the comments with dead comments? Bot comments/SEO?
- Sir_Cmpwn 8y agoIt's a C library. If it were a Rust or C++ library it would be written in those languages.
- zemoo 8y agoThat does not always necessarily follow. The VC runtime, for the C portion of the library, is now written in C++ internally.
- waruqi 8y agoThe rust/C++ syntax is too complicated, I don't like it.
- darkpuma 8y ago> "Bot comments" Pretty obviously. Gods know why though.
- waruqi 8y agoNo, some simple comments from some of my colleagues and friends were identified as bot comments. I'm sorry.
- mises 8y agoSo 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.
- waruqi 8y agoTheir own account, only one.
- sctb 8y agoI'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 https://news.ycombinator.com/newsfaq.html. If users aren't posting qua community members then the expectation is to provide a disclaimer.
- mises 8y agoOk, thanks. Also, awesome work; this looks very useful.
- tomcam 8y agoThe 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.
- ggm 8y agohow does it handle u_128 (IPv6 comparison/sorting/hashing) two u_64 is .. sad (sometimes unavoidable) no bzip2 but other good modern compressors which I guess is about what you need for jar and zip files. openssl compatible crypto .. oy vey the chain of "who audits the code is now a mile long at the microphone"
- waruqi 8y agoThere is no support for u_128 yet, but I can consider it.
- ggm 8y agoIf 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.
- waruqi 8y agoYes, I agree.
- azhenley 8y agoI’m working on a compiler right now that generates C. Should I use this for the generated code? (Or should I use glib, musl, or uclib?) A comparison chart would be helpful! Similar to: http://www.etalabs.net/compare_libcs.html http://www.etalabs.net/compare_libcs.html
- flukus 8y ago> 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.
- waruqi 8y agoYes.
- AndyKelley 8y agoTo 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]. [1]: https://ziglang.org/download/0.4.0/release-notes.html#Zig-ships-with-libc https://ziglang.org/download/0.4.0/release-notes.html#Zig-sh... [2]: https://ziglang.org/download/0.4.0/release-notes.html#Libc-Detection https://ziglang.org/download/0.4.0/release-notes.html#Libc-D...
- waruqi 8y ago
- mikelpr 8y agowhy didn't you build off musl?
- waruqi 8y agoI don't want to have any third-party library dependencies.
- torstenvl 8y agoYour source files contain the following in the commented header: "Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements." Did you in fact specifically license it to the ASF? Or are you just licensing it under the Apache license?
- waruqi 8y agoI just used the Apache license.
- jahewson 8y agoApache committer here - you’ve got the wrong header there. That one’s for source which has been committed to ASF repos under a CLA. You want the header for non-ASF code which can be found here: http://www.apache.org/licenses/LICENSE-2.0.html#apply http://www.apache.org/licenses/LICENSE-2.0.html#apply
- mises 8y agoThey've got a bunch of other cool projects, too: https://tboox.org/project/ https://tboox.org/project/ 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.
- hliyan 8y agoWhat does "modern" mean in this context?
- waruqi 8y agoOk, Now the title has been modified, maybe the previous title is not reasonable.
- tomcam 8y agoCongratulations on an absolutely massive achievement! I love seeing high-quality C libraries appear. What version of C does it target?
- waruqi 8y agoc99
- Gibbon1 8y agoNot supporting obsolete versions of C is utterly awesome.
- waruqi 8y agoC89 is too old, too many grammar restrictions. And now the mainstream compiler basically supports c99.
- Gibbon1 8y agoThat could be interpreted as sarcasm. It's not.
- Crinus 8y agoWhat 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)
- desiderantes 8y agoI think that if you're going to compare your library to GLib, then at least a basic comparison of features, side by side, should be available
- sansnomme 8y agoCongrats on shipping! This is really good advertisment for Xmake btw :)
- j1elo 8y agoI 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 :)
- waruqi 8y agoYes.
- andrewbinstock 8y agoI'm not seeing tests anywhere. Am I blind or are they hidden away or non-existent? Thx in advance.
- eps 8y ago> 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).
- andrewbinstock 8y agoWait, 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.
- waruqi 8y agoThere are some tests in the demo (https://github.com/tboox/tbox/tree/master/src/demo https://github.com/tboox/tbox/tree/master/src/demo), but I still don't have time to write complete test cases. I'm sorry.