3 ms·
what are PC based languages ? what is PC short for in this context
by systems 6y ago
what are PC based languages ? what is PC short for in this context
- pjmlp 6y agoMS-DOS/Windows heritage. Modula-2, Pascal, C, C++, Basic based compilers with inline Assembly parsers or intrisics that interact with host language type system instead of manually dealing with strings UNIX style.
- dathinab 6y agoBut in rust asm! does interact with the type system. The asm macro does know about what group of registers (or what specific register) a input/output is stored/loaded from and compilation will fail if the input isn't compatible with the register. Then it's delegating to a assembler for the rest. Sure it could also have a list of all asm commands the given target does support and parameters/registers it can be used with but this means keeping track of all supported targets and all commands for all potential featuresets of all targets and all way they can be called. This is a lot of work. Even more such support can be added later one, too. For now it's more important to support asm on stable. Also with proc-macros you can implement this as a library on top of `asm`! Also with a more "knowledgeable" asm any support for a new platform would need to manually add support for all asm of that language so having a standard stringly interface is a good think anyway.
- jfkebwjsbx 6y agoWhat you describe is how it works in GCC/LLVM and is required in any inline asm system. Otherwise it is not really inline. Saying that fits with the type system is a stretch... it is like any other FFI.
- Rusky 6y agoThe use of strings in Rust's implementation is limited to the assembly template and the operand constraints. Functionally speaking, moving those out of strings gains you absolutely nothing and can make parsing more difficult. The important part, type system integration, is already there. Sizes must match, move and borrow checking still happens, etc. This avoids the typical failure modes of unix-like stringly-typed systems. In fact if you read the announcement and RFC, you'll see that this was a primary goal of the new design!