I think glib is generally superior to apr. glib has many more datastructures as portable libraries. e.g hash tables, all kind of lists, queues, stacks, dynamic array, also for argument parsing, file io has it's own wrappers also and memory managment is easy modifiable. E.g you can easily make glib use the Boehm Weisser GC this is AFAIKT never been done or easy possible with Apache. I would decide a bit different. If you need a more useful library of data structures glib is a better equipped. If it comes to GUI stuff than libapr has nothing whereas glib has gdk/gtk+ and a lot of stuff for gnome if you like.
However, if it comes to network stuff, libapr definitely has an edge over glib.
So my suggestions is
Desktop programming: Use GTK+ and glib.
Network stuff: Use apr, but be assured glib does have all this portable stuff also.
I'd go with APR. APR is better at portability Unix/Windows (being a dedicated portability library), GLib has traditionally been more Unix-oriented. APR is a larger library than GLib, with lots of useful stuff in it (hash tables, argument parsing, file I/O stuff, memory management, shared memory routines, signal handling, etc.).
Is there a reason you wouldn't want to use the c++ stl? Even if you are writing "c-style" code without classes, you can use c++ strings and data structure.
There are plenty of valid reasons to stick to C, of course. If that's the case, I would second the recommendation for glib. APR is more of a portability layer than a utility library.
发布评论
评论(3)
我认为glib总体上优于apr。 glib 有更多的数据结构作为可移植库。 例如哈希表、各种列表、队列、堆栈、动态数组,也用于参数解析,文件 io 也有它自己的包装器,并且内存管理很容易修改。 例如,您可以轻松地使用 Boehm Weisser GC 来使 glib 轻松起来,这是 AFAIKT 从未完成过的操作,或者使用 Apache 可以轻松实现。 我会做出一些不同的决定。 如果您需要更有用的数据结构库,glib 是更好的选择。 如果涉及到 GUI 的东西,libapr 就什么都没有了,而 glib 有 gdk/gtk+,如果你喜欢的话,还有很多 gnome 的东西。
然而,如果涉及到网络方面,libapr 绝对比 glib 有优势。
所以我的建议是
I think glib is generally superior to apr. glib has many more datastructures as portable libraries. e.g hash tables, all kind of lists, queues, stacks, dynamic array, also for argument parsing, file io has it's own wrappers also and memory managment is easy modifiable. E.g you can easily make glib use the Boehm Weisser GC this is AFAIKT never been done or easy possible with Apache. I would decide a bit different. If you need a more useful library of data structures glib is a better equipped. If it comes to GUI stuff than libapr has nothing whereas glib has gdk/gtk+ and a lot of stuff for gnome if you like.
However, if it comes to network stuff, libapr definitely has an edge over glib.
So my suggestions is
我会选择APR。 APR 更擅长 Unix/Windows 的可移植性(作为专用的可移植性库),GLib 传统上更面向 Unix。 APR 是一个比 GLib 更大的库,里面有很多有用的东西(哈希表、参数解析、文件 I/O 东西、内存管理、共享内存例程、信号处理等)。
I'd go with APR. APR is better at portability Unix/Windows (being a dedicated portability library), GLib has traditionally been more Unix-oriented. APR is a larger library than GLib, with lots of useful stuff in it (hash tables, argument parsing, file I/O stuff, memory management, shared memory routines, signal handling, etc.).
您有什么理由不想使用 c++ stl 吗? 即使您正在编写没有类的“C 风格”代码,您也可以使用 C++ 字符串和数据结构。
当然,有很多充分的理由坚持使用 C。 如果是这样的话,我会支持 glib 的建议。 APR 与其说是一个实用程序库,不如说是一个可移植层。
Is there a reason you wouldn't want to use the c++ stl? Even if you are writing "c-style" code without classes, you can use c++ strings and data structure.
There are plenty of valid reasons to stick to C, of course. If that's the case, I would second the recommendation for glib. APR is more of a portability layer than a utility library.