News for hackers. Stuff that matters.
Re:Undefined Behavior in 2017 by pjmlp on Wednesday July 05, 2017 @06:06AM (#14701140)
> garbage collection is easy...

Garbage collection isn't the only way of writing mostly safe systems programs.

ESPOL, NEWP are 10 year older than C.

PL/8 was the systems programming language used by IBM for their first RISC mainframe, followed by PL/S.

Mesa used at Xerox PARC.

Modula-2 used at ETHZ and many 16 bit systems.

Object Pascal used to write the first versions of Mac OS and Lisa.

Ada and SPARK used by high integrity systems where human lives can be at risk.

All of them with not even a quarter of C's UB collection.

Re:Undefined Behavior in 2017 by jabot on Wednesday July 05, 2017 @08:33AM (#14701867)
Well, I don't know about half of these programming languages. However:

- ADA requires garbage collection

- Modula-2 and Object pascal have manual memory management, i.e.: "new" and "delete" - together with double-free, use-after-free, and dangling pointers...

I agree that C is by far worse, but please recognize that at least some of the undefined behavior problems are really hard to solve.

EDIT: Oh, and we haven't started talking about multi threading yet, have we?

Re:Undefined Behavior in 2017 by pjmlp on Wednesday July 05, 2017 @10:24AM (#14702621)
What about learning to understand English?

"writing mostly safe systems programs."

Do you understand what mostly means?

Ada and Modula-2 have multi-threading as part of their ISO/ANSI language standard.

Also you don't seem to know much about Ada given your GC remark, but here is some learning.

https://archive.fosdem.org/2016/schedule/event/ada_memory/

Of course there are still use cases where Algol derived languages are still unsafe, however those use cases are a tiny portion of what happens in C land.

Re:Undefined Behavior in 2017 by jabot on Thursday July 06, 2017 @02:40AM (#14708564)
> What about learning to understand English?

That's uncalled for, man...

> Of course there are still use cases where Algol derived languages are still unsafe, however those use cases are a tiny portion of what happens in C land.

On that I agree - there are many problems we wouldn't have if we were using, say, pascal or modula.

> Also you don't seem to know much about Ada given your GC remark, but here is some learning.

I'm sorry, I don't have time to watch that. However, I know that ADA has either GC or manual memory management (with the deallocation method explicitly marked as unsafe). Thus, as far as i know, constructing "use-after-free" in Ada is possible - which is undefined behavior (and that was my point).