5 ms·
The list of supported platforms for FPC is pretty impressive[0], whereas LLVM support in FPC appears to be very new, and FPC has very limited platform support u
by coder543 5y ago
The list of supported platforms for FPC is pretty impressive[0], whereas LLVM support in FPC appears to be very new, and FPC has very limited platform support using LLVM anyways[1]. LLVM really means nothing for FPC's portability story at this point, as far as I can tell.
I'm skeptical that targeting C opens up any meaningful additional platform support beyond what FPC natively supports. Even relatively new and/or niche architectures like RISC-V and Xtensa appear to be supported by FPC.
(C code also isn't perfectly portable by any stretch of the imagination, so just having some random C compiler for your platform of choice and some emitted C code doesn't really guarantee that you'll end up with a compatible, working solution.)
I've never used Lazarus or FPC beyond just opening it up and playing with it in years past, but it is interesting how much that ecosystem seems to offer.
[0]: discussed in the first paragraph here: https://www.freepascal.org/ https://www.freepascal.org/
[1]: https://wiki.freepascal.org/LLVM#Progress https://wiki.freepascal.org/LLVM#Progress
- mercurialuser 5y agoharbour, a open source clone of xbase/clipper language, targets vanilla C and can run on very different platforms, from msdos to android. on windows, several c compilers are supported, from pelles to bcc to gcc to intel... it works.
- coder543 5y ago> several c compilers are supported Which is completely different from assuming that emitted C automatically compiles and runs fine under any C compiler under the sun on any target platform, which seemed to be the implied assumption made by the person I was replying to. I definitely could have misinterpreted. Regardless, my main point is that FPC already seems to support… pretty much everything, which is impressive. They’ve clearly done a lot of work on portability over the years.
- blizdiddy 5y agoC is an ISO standard. That's how it works when you code to the standard.
- coder543 5y agoI wish C were that simple and well defined. The C standard leaves a lot of UB/implementation specific behavior. Fully “standards-compliant” code that works on one compiler may behave in unexpected ways under another compiler, just due to differences in UB handling. And no, it is not trivial to write UB-free C code. Let’s say you are generating C code from your own programming language. Did you know that an infinite loop that doesn’t do anything might be ignored?[0] This materially changes the behavior of the input program in ways that most people wouldn’t expect. C can quickly go from “infinitely portable assembler for my cool new language” to “major source of confusion.” That’s before even discussing compiler bugs, which will unintentionally break all assumptions of well-behaved code. Rust has run into (and submitted fixes for) so many LLVM bugs over the years that caused silent miscompilation. Complex software tends to have bugs somewhere, and a lot of compilers are complex. The less trivial the C code, the more likely you are to run into compatibility problems between compilers. “Hello world” should reliably work everywhere, so that’s something… I guess. But that’s just like… my opinion. If generating arbitrary C code and shoving it through arbitrary C compilers works reliably for you, then that’s cool? I personally would want to see a large battery of tests that ensures the program code is likely to be working under each new compiler. [0]: https://stackoverflow.com/questions/59925618/how-do-i-make-an-infinite-empty-loop-that-wont-be-optimized-away https://stackoverflow.com/questions/59925618/how-do-i-make-a...
- mercurialuser 5y agoI understand what you say but FPC and Harbour just show that writing portable c code is actually possible... https://github.com/harbour/core#supported-platforms-and-c-compilers https://github.com/harbour/core#supported-platforms-and-c-co...
- as1mov 5y agoDoes FPC/Lazarus have any kind of commercial backing by companies? Honestly the amount of platforms they support is pretty impressive, yet it remains pretty obscure. The only other project I can think of which remains relatively unknown but still manages to chug along is Tcl (supported by Flightaware and a bunch of other companies iirc).
- coder543 5y agoI'm not sure what kind of commercial backing FPC or Lazarus have, if any. As I mentioned, I've never actually used it for anything serious, so I can't really speak to how good it is. Yeah, there are a lot of relatively unknown projects that keep going. Pharo (a smalltalk inspired language) is another example of such a thing that I've also never used.