Most active commenters
  • grandempire(9)
  • pjmlp(9)

←back to thread

218 points signa11 | 35 comments | | HN request time: 0.454s | source | bottom
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 #
1. grandempire ◴[] No.43682246[source]
Which other popular language more accurately represents a random access machine of fixed word length?
replies(3): >>43682309 #>>43682371 #>>43682763 #
2. alexvitkov ◴[] No.43682309[source]
None, but that'a not what computers are. C assumes that in a few places, e.g. variadic functions, and those are the worst parts of the language.
replies(1): >>43682322 #
3. grandempire ◴[] No.43682322[source]
> but that'a not what computers are

Which language more accurately represents hardware then?

replies(3): >>43682445 #>>43682466 #>>43682491 #
4. pjmlp ◴[] No.43682371[source]
I don't know, Ada, Modula-2, Object Pascal, PL/I, NEWP, PL.8, D, Zig, Mesa, ATS,....

But then again, you booby trapped the question with popular language.

replies(2): >>43682583 #>>43682636 #
5. pjmlp ◴[] No.43682466{3}[source]
Assembly language from the hardware vendor.
replies(1): >>43682533 #
6. alexvitkov ◴[] No.43682491{3}[source]
C++ for one - it has atomics with well defined memory barriers, and guarentees for what happens around them.

The real answer is obviously Assembly - pick a random instruction from any random modern CPU and I'd wager there's a 95% chance it's something you can't express in C at all. If the goal is to model hardware (it's not), it's doing a terrible job.

replies(2): >>43682642 #>>43683141 #
7. oguz-ismail ◴[] No.43682533{4}[source]
isn't it translated to microcode before being executed?
replies(1): >>43682997 #
8. guywithahat ◴[] No.43682583[source]
If a language is unpopular, people won't want to work for you and you'll run into poor support. Rewriting a library may take months of dev time, whereas C has an infinite number of libraries to work with and examples to look at.
replies(2): >>43682910 #>>43701784 #
9. grandempire ◴[] No.43682636[source]
Many of those languages do not have pointers - which are fundamental to how modern instruction sets work.
replies(1): >>43682903 #
10. sugrado ◴[] No.43682638{4}[source]
bro just quoted a chatbot
11. grandempire ◴[] No.43682642{4}[source]
C++ better represents the machine?
12. 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 #
13. 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 #
14. grandempire ◴[] No.43682884[source]
It also has pointers which are absent from most languages but essential to instruction sets.
replies(1): >>43682988 #
15. pjmlp ◴[] No.43682903{3}[source]
Yes they do, point an example from that group, and I will gladly prove you wrong.
replies(2): >>43682999 #>>43683399 #
16. pjmlp ◴[] No.43682910{3}[source]
Moving goalposts regarding systems programming languages features, some on the group predate C by a decade.
replies(1): >>43683148 #
17. pjmlp ◴[] No.43682988{3}[source]
Lots of languages since the 1950's have pointers.
18. pjmlp ◴[] No.43682997{5}[source]
Depends on the hardware design.
19. ◴[] No.43682999{4}[source]
20. uecker ◴[] No.43683141{4}[source]
C has the same atomics and concurrency model as C++.
21. guywithahat ◴[] No.43683148{4}[source]
Being old doesn't mean anyone knows the language. I mean if the language predates C significantly and nobody uses is then there's probably a really good for it. The goalposts aren't moving they're just missing the shot
replies(1): >>43684997 #
22. grandempire ◴[] No.43683399{4}[source]
Well sounds like you are confident and we are going to get into a semantic argument about what qualifies as a pointer.

So which of these languages do you think is a better representation of hardware and not a PDP-11?

replies(1): >>43689392 #
23. codr7 ◴[] No.43683999[source]
It puts less obstacles in the way of dealing with hardware than almost any other language for sure.

What's standardized was never as important in C land, at least traditionally, which I guess partly explains why it's trailing so far behind. But the stability of the language is also one of its features.

24. codr7 ◴[] No.43684008{3}[source]
Only if you don't know C.

Otherwise is says, do whatever you feel like.

25. cv5005 ◴[] No.43684237[source]
simd doesnt make much sense as a standard feature/library for a general purpose language. If you're doing simd its because you're doing something particular for a particular machine and you want to leverage platform specific instructions, so thats why intrinsics (or hell, even externally linked blobs written in asm) is the way to go and C supports that just fine.

But sure, if all youre doing is dot products I guess you can write a standard function that will work on most simd platforms, but who cares, use a linalg library instead.

26. cv5005 ◴[] No.43684308{3}[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.
27. OCASMv2 ◴[] No.43684997{5}[source]
Popularity isn't a measure of quality. Never has been and certainly not in the case of programming languages.
replies(1): >>43685645 #
28. grandempire ◴[] No.43685645{6}[source]
There is unpopular - and then there is can I get a working toolchain for modern OS that’s not emulated.
replies(1): >>43686764 #
29. OCASMv2 ◴[] No.43686764{7}[source]
Still not a measure of quality.
replies(1): >>43687227 #
30. grandempire ◴[] No.43687227{8}[source]
Are we having a discussion about the greatest language of all time? What’s your context here.
31. pjmlp ◴[] No.43689392{5}[source]
Better representation of the hardware?

None of them, you use Assembly if you want the better representation of hardware.

Yes, I am quite confident, because I have been dispelling the C myth of the true and only systems programming language since the 1990's.

replies(1): >>43695517 #
32. grandempire ◴[] No.43695517{6}[source]
So then your comment about C being an outdated PDP-11 must be equally true of other languages. So it says nothing.
replies(1): >>43703827 #
33. ryao ◴[] No.43701784{3}[source]
wears math hat

C does not have an infinite number of libraries and examples. The number of libraries and examples C has is quite large, and there are an infinite number of theoretically possible libraries and examples, but the number of libraries and examples that exist are finite.

replies(1): >>43711414 #
34. pjmlp ◴[] No.43703827{7}[source]
Not really, some of those languages predate the very existence of C and PDP-11.
35. Koshkin ◴[] No.43711414{4}[source]
The infinite is a convenient abstraction of the finite.