4 ms·
Because, C is portable assembler. In Pascal, for example, if something cannot be done in Pascal, then assembler must be used. If assembler is used, then program
by v_lisivka 7y ago
Because, C is portable assembler. In Pascal, for example, if something cannot be done in Pascal, then assembler must be used. If assembler is used, then program is tied to single platform. If you need to support two or more platforms at same time over long period, then C wins.
- pjmlp 7y agoThat is the myth, in practice ISO C specifies an abstract machine and libc is impossible to be written 100% in ISO C, some functions require either external Assembly or language extensions for their implementation.
- int_19h 7y agoI would also be curious what are all those things that C can do but e.g. Modula-2 cannot, when it comes to being a "portable assembler".
- pjmlp 7y agoNaturally Modula-2 also faces the same issue. What it offers is better type safety and being honest about it. The whole point is that contrary to its sales prospect, not only does C also require to write Assembly, it doesn't have any language support for modern hardware CPU/GPUs, just like any other high level language, requiring extensions to the standard, not necessarly portable across implementations.
- v_lisivka 7y agoToo many years are passed, but as far as I remember, only C code was portable between 8, 16, and 32 bit platforms. It was possible to incrementally convert program from assembler to C and then port to different platforms, but it was not possible to do conversion using Pascal, or other programming language.
- pjmlp 7y agoYeah, if you were writing using a safe subset across all C variants that happened to be supported across all those C compilers. Check language support across Small-C, Turbo C, Quick C, Aztech C, Metrowerks C and many others from those days. Likewise it was possible to do the same across Pascal compilers that implemented variants of ISO Extended Pascal/UCSD Pascal, Modula-2 and a couple of other high level languages.
- afiori 7y agoC the language can be portable even if the libc is entirely in assembly. Of course you assume to have compiler/std on the platform you want to use it.
- pjmlp 7y agoThat capability is shared among all high level programming languages, nothing special about C here, once upon a time it was also only available to UNIX users.
- afiori 7y agoMy understanding is that C/UNIX were together portable between platforms. Portability of C between OS was relevant mostly later.