←back to thread

218 points signa11 | 3 comments | | HN request time: 0.594s | source
Show context
pjmlp ◴[] No.43681194[source]
> The reason I believe C is and always will be important is that it stands in a class of its own as a mostly portable assembler language, offering similar levels of freedom.

When your computer is a PDP-11, otherwise it is a high level systems language like any other.

replies(7): >>43682173 #>>43682246 #>>43682554 #>>43682928 #>>43683332 #>>43683914 #>>43701871 #
grandempire ◴[] No.43682246[source]
Which other popular language more accurately represents a random access machine of fixed word length?
replies(3): >>43682309 #>>43682371 #>>43682763 #
kryptiskt ◴[] No.43682763[source]
C lacks sympathy with nearly all additions to hardware capabilities since the late 80s. And it's only with the addition of atomics that it earns the qualification of "nearly". The only thing that makes it appear as lower level than other languages is the lack of high-level abstraction capabilities, not any special affinity for the hardware.

For one, would expect that a low level language wouldn't be so completely worthless at bit twiddling. Another thing, if C is so low level, why can't I define a new calling convention optimized for my use case? Why doesn't C have a rich library for working with SIMD types that has been ubiquitous in processors for 25 years?

replies(4): >>43682820 #>>43682884 #>>43683999 #>>43684237 #
1. kryptiskt ◴[] No.43682820[source]
Like, say I have a data structure that is four bits wide (consisting of a couple of flags or something) and I want to make an array of them and access them randomly. What help do I get from C to do this? C says "fuck you".
replies(2): >>43684008 #>>43684308 #
2. codr7 ◴[] No.43684008[source]
Only if you don't know C.

Otherwise is says, do whatever you feel like.

3. cv5005 ◴[] No.43684308[source]
Pick an appropriate base type (uintN_t) for a bitset, make an array of those (K * N/4) and write a couple inline functions or macros to set and clear those bits.