News for hackers. Stuff that matters.
Re:What Every C Programmer Should Know About Undefined Behav... by dragonwriter on Thursday January 05, 2017 @09:39AM (#13327384)
> C is dang near as close to the hardware as you can get without touching it

Not really; it's structurally nothing like assembly, which is as close as you can get to the hardware without just handcoding machine code.

Now, C -- for a structured language with static typing -- provides very little in terms of safety features that get in the way of direct hardware manipulation, whereas lots of languages with superficially similar structure aim to be safe in some ways by default which makes some hardware manipulation more difficult, or at least more verbose, than it would be in C. So, in some ways it gets less in the way of freedom to manipulate the hardware than some other structured programming languages.

But it's not particularly close to the hardware at all.

Re:What Every C Programmer Should Know About Undefined Behav... by nickpsecurity on Thursday January 05, 2017 @10:27AM (#13327819)
To support your argument, p-code is closer to what a portable, assembly language looks like. It's an abstract machine that can be trivially targeted to about any CISC or RISC machine. Let amateurs without compiler knowledge port Pascal/P to around 70 architectures in 2 years.

https://en.wikipedia.org/wiki/P-code_machine

Linoleum was another:

http://anynowhere.com/bb/layout/html/frameset.html

The closest in C land was C-- by Jones et al which still looks heavy compared to p-code:

http://www.cs.tufts.edu/~nr/c--/index.html

Re:What Every C Programmer Should Know About Undefined Behav... by qwertyuiop924 on Thursday January 05, 2017 @10:03AM (#13327578)
>Not really; it's structurally nothing like assembly, which is as close as you can get to the hardware without just handcoding machine code.

Here, assembly is touching the hardware. If you write your code in assembly, it's not portable to other architectures, even hypothetically.

>provides very little in terms of safety features that get in the way of direct hardware manipulation

Exactly. So it's a heck of a lot closer to the hardware than most 3GLs.