3 ms·
When hearing a claim such as "there is a substantial gap between the capabilities of hardware and C", my first question is "what hardware"? Last I checked, C w
by josteink 13y ago
When hearing a claim such as "there is a substantial gap between the capabilities of hardware and C", my first question is "what hardware"?
Last I checked, C was used on lots of hardware, lots of it which differs substantially from the X86 architecture.
C aims to be portable. For it to be portable its constructs must be so too.
If there exists hardware which doesn't have a carry-flag (like mentioned elsewhere in this thread), exposing it to the C-programmer will result in non-portable code, or a need for (possibly inefficient) compiler-internal workarounds.
Looking at it the other way around, namely upwards the abstraction layer, C has a very limited capability to convey the intent of code. Lots of hardware has the capability to process things in parallel, and C doesn't have any way to exploit that without explicit code to do so.
And as long as C is meant to be portable, that has to be allright.
- thesz 13y agoImagine for a second you have to run C on Setun [1]. What features you have to remove from C? C exposes hardware much more than many other languages. [1] http://en.wikipedia.org/wiki/Setun http://en.wikipedia.org/wiki/Setun
- sanxiyn 13y agoCarry flag emulation may be "possibly inefficient" on architectures without carry flag, but not exposing carry flag on architectures with carry flag is definitely inefficient. I don't think it is the right tradeoff. Consider that many architectures on which C can be used lack hardware multipliers. This is totally not an argument against having multiplication in the language.
- ketralnis 13y agoBut I don't need to run my code on that hardware. I need to run my code on a particular subset of hardware. I don't want the programming language that I use the most to tell me that I can't have the features I want because somebody else doesn't have them. "Just because a baby can't chew a steak doesn't mean that a man must drink milk for dinner" There's a half way point: expose directives that say "I'm going to use this feature, so just refuse to compile if it's not available".