Re:How to get started with the LLVM C API
by valleyer on Wednesday January 21, 2015 @01:53PM
(#8924741)
Their C API is so much cleaner looking than the C++ one, imo. I avoided it so far thinking that once I want to use something not covered in the C API, I don’t want to do a big refactor. Is that a rational fear?
[ Parent
| on HN ]
Re:How to get started with the LLVM C API
by rubiquity on Wednesday January 21, 2015 @03:24PM
(#8925482)
This seems to happen a lot to projects that are written in C++ but have C APIs. Another good example of this would be ZeroMQ. I wonder why this happens.
If I remember correctly from an article many years ago, they want the C++ API to be high-level and fast-moving; the C API exists so that they can support low-level use and almost all clients while only maintaining one API well.
Re:How to get started with the LLVM C API
by kozlinov on Wednesday January 21, 2015 @05:01PM
(#8926075)
This is a psychological effect caused by some deficiencies in human thinking. People feel obliged to use OOP in full once it is available and shit all over the place with classes, interfaces and inheritance. In a more limited language it is harder to multiply entities, so they just do not do it. So it may make sense to add some artificially crafted pain into a language to force people to write less code.
Re:How to get started with the LLVM C API
by Guthur on Wednesday January 21, 2015 @05:39PM
(#8926284)
Interestingly Martin Sustrik, one of the original ZeroMQ authors, expressed regret for having chosen C++ for ZeroMQ.
Re:How to get started with the LLVM C API
by sclangdon on Thursday January 22, 2015 @02:53AM
(#8928051)
And as some of the comments on his blog point out, he uses C++ in a C style.
"If you insist on sticking to a conventional C style of C++ code, you’ll get conventional C-style problems" - Bjarne Stroustrup (http://www.informit.com/articles/article.aspx?p=2080042)
Re:How to get started with the LLVM C API
by alexchamberlain on Wednesday January 21, 2015 @04:15PM
(#8925832)
C++ is an awesome languages for writing algorithms and low level memory manipulation, such as network protocols. The big problem is the ABI sucks, although on Linux the story is better than elsewhere. Even on Linux mangling is just confusing.
Re:How to get started with the LLVM C API
by faragon on Wednesday January 21, 2015 @04:48PM
(#8925994)
"The big problem is the ABI sucks"
The problem is that there is no standard ABI call for C++, as implentation is vendor-specific (it may change even for same vendor between different compiler versions (!)). It would be hard to "fix" that, e.g. virtual function tables, exceptions, etc. For standard bindings, C is the only sane option.