Light C 数据结构和字符串库?
我正在寻找 C 的 GNU 扩展级别的东西,但有点超出(一些基本的数据结构管理)。最好是 BSD/MIT 许可的东西。
如果有一些东西只包含包含 GNU 扩展等效项的字符串,再加上添加更多内容,那就太好了。
我更喜欢完全基于 C 标准(如果可能的话,ANSI C89)可以简单地编译到项目中(没有外部库)的东西。
编辑:它是一个具有奇怪许可证的开源项目,因此无法添加 GPL 代码,并且使用普通的 K&R/ANSI C 纯粹是痛苦。
I'm searching for something on the level of GNU extensions for C, but a little beyond (some basic data structure management). Best would be something BSD/MIT licensed.
If there is something for just strings containing GNU extensions equivalents plus adding some more it would be great.
I would prefer something that can be simply compiled into a project (no external libraries) based totally on the C standard (ANSI C89 if possible).
Edit: its for an OpenSource project that has a weird license, so no GPL code can't be added and working with plain K&R/ANSI C is pure pain.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这个问题似乎已经在此处得到解决。
我实际上写了一个有点长的回复(推荐 Glib 并提到 Lua 从 5.0 开始是 MIT,而不是 BSD),但是我的机器中途崩溃了:(
This question already seems to be addressed here.
I actually wrote a somewhat lengthy response (recommending Glib and mentioning that Lua since 5.0 is MIT, not BSD), however my machine crashed half-way through :(
跳出框框思考,一种可行但另类的方法是使用 Lua。它很小,用 ANSI C 的子集编写,同时也是有效的 C++,并且为字符串和关联数组提供了丰富的垃圾收集环境。
它可以构建为共享库,但也可以静态链接。
诚然,当完全从 C 端驱动其数据类型时,它可能会感觉有点冗长,但很容易将应用程序的一些更高级别的逻辑移动到其数据正常工作的 Lua 端。它的 VM 经过高度调优,使其性能比解释型脚本语言的预期更好,并且有一个 JIT 编译器 在现有虚拟机速度不够快的情况下也可用。
它也是开源的并且MIT 许可。
Thinking outside the box, a viable but off-the-wall approach is to use Lua. It is small, written in the subset of ANSI C that also happens to be valid C++, and supplies a rich garbage collected environment for strings, and associative arrays.
It can be built as a shared library, but it can also be statically linked.
It can admittedly feel a tad verbose when driving its data types entirely from the C side, but it is easy to move some of the higher level logic of your application into the Lua side where its data just works. Its VM is highly tuned, allowing it to perform better than one would expect for an interpreted scripting language, and there is a JIT compiler available as well for those times when its existing VM just isn't quite fast enough.
It is also open source and MIT licensed.