On Fri, Mar 30, 2012 at 10:22 AM, Alexis López Zubieta <firstname.lastname@example.org>
El 29/03/12 19:09, PCMan escribió:
> When GObject is involved, the readability of Vala code tends to bePCMan did you ever consider use C++ in the development of libfm. I have
> much better then its C counterpart.
been making some experiments with GObject and C++ and I found that C++
is more efficient and clear when you are going to use objects.
Yes, I did some experiments with c++ as well, but here are the drawbacks.
1. ABI instability. It's very hard to maintain ABI compatibility with C++.
2. Slow startup time and large symbol table due to unnecessary export of many long symbols caused by name mangling.
3. Significantly larger binary size + dependency on libstdc++.
4. UTF-8 support is not widely available. STL strings works with ASCII only. wstrings need additional encoding conversion.
5. No reference counting support. Using boost::intrusive_ptr may solve this, but the code will become very long.
6. Compilation is really slow for large projects.
7. Harder to debug.
8. Hard to use in non-C++ projects, such as some plain C programs and vala projects.
9. Too complicated and hard to master. Error-prone if not used correctly
10.Existing code is almost finished. Rewriting with C++ is just a waste of time.
11.Vala provides similar code readability but 100% integration with GObject without additional dependency. I think it's enough for me.
12.I fully agreed that the objects provided by C++ is cleaner than the terrible GObject runtime system. However, the additional costs and side effects it brings just offset the benefit. Porting to actually C++ means a complete rewrite.
Personally I like C++ and use it under Windows since it's very difficult to develop Windows programs with plain C.
In this case, I think C language is a more suitable choice, especially when it's intended to be used in other C programs.
Please count on my.
Alexis López Zubieta
University of Informatics Sciences
10mo. ANIVERSARIO DE LA CREACION DE LA UNIVERSIDAD DE LAS CIENCIAS INFORMATICAS...
CONECTADOS AL FUTURO, CONECTADOS A LA REVOLUCION