5 ms·
You are probably right. :-) C is incredibly easy to grok if you know assembler. kicking goalpost a little
by actionfromafar 3y ago
You are probably right. :-) C is incredibly easy to grok if you know assembler. kicking goalpost a little
- pjc50 3y agoI sometimes think we'd be better off with a "typesafe macro assembler" for some of the C uses. People keep using C for this when it really isn't, and then get kicked in the face by UB/optimizer interactions deleting security critical code.
- actionfromafar 3y agoYes, djb wanted a C flavour with no UB. That could also work. A macro assembler could fall behind optimizations, but a C with no UB could still optimize pretty well I reckon. Maybe there is a small market for an optimized language with no UB.
- pjc50 3y ago"No UB" is really hard to do without sacrificing some portability. It took C decades to specify that arithmetic was twos-complement, for example. However "UB means the optimizer is free to change the semantics on the assumption that you don't hit UB" is a huge source of surprises.
- samatman 3y agoLLVM IR is an acceptable meta-assembler for most purposes. The degree to which it's used directly is roughly the degree to which people find that sort of tool useful, and it is used directly to some degree. It would be a worthy project to write a language with the goal of providing the minimum affordances to LLVM IR to make it pleasant to program in, without fully obscuring what you're doing. I'd play around with it.
- jstimpfle 3y agoIf I got kicked in the face by UB/optimizer in the last 5 years then I didn't notice.