4 ms·
>>>yes, C and C++ are more portable than LLVM C and C++ are more portable then their own compiler's backend? LLVM is clang/clang++'s assembler I get what your
by valarauca1 10y ago
>>>yes, C and C++ are more portable than LLVM
C and C++ are more portable then their own compiler's backend? LLVM is clang/clang++'s assembler
I get what your saying if you compile to C it can be more portable. But then you need to compile to some C standard.
K&R C? ANSI C? C90? C99? C11? Why not have a compiler flag for each? What about embedded C? What companies embedded C?
I can repeat this for C++
Compiling to C/C++ in a platform and standard agnostic way is impossible.
- jjnoakes 10y agoLots of languages do it already. How is it impossible?
- valarauca1 10y agoNo. Lots of languages can give you a dump in 1 standard of C. You can't specify what C standard, or what platform to output outside of ARM/x64. NIM, Cython, C++ (via clang), [Ada/Cobalt/Fortran]-GCC, Perl, Agol, Oracle PL/SQL only support x86_64 and ARM. Your argument was interoperability and portability 1) Rust outputs to the same object file format as C, and can be natively linked against C/C++ code. So interoperability is no issue. 2) You have no portability gain as you have 3 choices x86, x64, and ARM. All of which Rust already supports. Also your main request $ rustc your_program.rs --emit llvm-ir $ llc -march=c -o your_program.c your_program.ll or if you want C++ $ rustc your_program.rs --emit llvm-ir $ llc -march=cpp -o your_program.cpp your_program.ll
- jjnoakes 10y agoWho needs more than one dialect of C or C++? I don't. Any systems I'm interested in may not support clang, but they have C11 compilers and C++14 compilers. Rust is not interoperable with C++ as far as I know, and even if it was, I'm not interested in Rust for this discussion for reasons I've mentioned elsewhere. The LLVM C backend was removed. Julia devs have a version that supports the LLVM bit code that they require, but I believe it is not everything LLVM can produce. I was under the impression that march=cpp output C++ code that rebuilt the IR, not implemented the source program. Thanks for the advice, although none of it really applies to what I'm suggesting.