4 ms·
C has one quality that no other language has. You can write libraries in it that can easily be used from all other languages on every platform.
by fauigerzigerk 10y ago
C has one quality that no other language has. You can write libraries in it that can easily be used from all other languages on every platform.
- pjmlp 10y agoThat is only true if the OS was written in C. What many wrongly call the C ABI is actually the OS ABI.
- fauigerzigerk 10y agoThe ABI is certainly helpful, but I don't think it's the only reason why C libraries are easier to call than libraries written in other languages. C doesn't have generics, inheritance or a GC, all of which make integration a lot more difficult.
- pjmlp 10y agoA set of features shared by many other, safer, system programming languages. Their OSes didn't had a C ABI, rather an ESPOL, NEWP, Modula, and so forth ABI.
- fauigerzigerk 10y agoSure, theoretically there could be viable alternatives to C.
- pjmlp 10y agoWhat makes many of us sour, is that it isn't theory, rather already proven in the past, back when C was only a UNIX language and barely relevant outside it. It was the commoditization of UNIX in the industry that pushed C outside UNIX, just like we nowadays have JavaScript outside the browser.
- fauigerzigerk 10y agoIt sounds remote today, but you're right that it didn't have to be this way. What should make you even more sour is that another opportunity for starting over seems to have been passed up when Google only recently chose to build Fuchsia on top of a C++ based kernel.
- iamcreasy 10y ago"...C ABI is actually the OS ABI." Can you please elaborate on it please?
- clouddrover 10y agoI don't think that's a special or unique quality of C. I'd say it's equally true of Pascal: http://www.freepascal.org/docs-html/prog/progse55.html http://www.freepascal.org/docs-html/prog/progse55.html
- fauigerzigerk 10y agoI think Free Pascal supports all sorts of features that don't translate very well across type systems. Things like classes, inheritance and even generics I believe.
- clouddrover 10y agoI'm not sure what point you're making. You don't export those types or features in your library's API. Here's some discussion of type compatibility between C\C++ and Pascal: http://www.rvelthuis.de/articles/articles-convert.html http://www.rvelthuis.de/articles/articles-convert.html
- fauigerzigerk 10y agoThe point I'm making is that you can write reasonably idiomatic C and export the result for use in other languages. There are some things in C that are not easily exported, like varargs or complex macros, but on the whole the impedance mismatch is a lot less dramatic than in any other language I know, including of course C++.
- clouddrover 10y ago> The point I'm making is that you can write reasonably idiomatic C and export the result for use in other languages. And as I say, you can do the same in Pascal. We're back where we started. :)
- fauigerzigerk 10y agoMaybe your experience with translating complex type system features and generics from one language to another has been more pleasant than mine.