News for hackers. Stuff that matters.
Re:On Apple's Love Affair with Swift by hedora on Saturday August 11, 2018 @01:55PM (#17740737)
People have written and continue to write secure C code, and insecure code in “safe” languages.

I have written systems in memory safe languages. The languages that provide memory safety also incur GC pauses, which means they’re unsuitable for applications where latency matters at all. (I’ve also noticed that programs written by professionals in memory safe languages tend to have many more serious high-level bugs than those written in C/C++, but I don’t have data to back that up.)

Re:On Apple's Love Affair with Swift by icebraining on Saturday August 11, 2018 @02:22PM (#17740880)
> The languages that provide memory safety also incur GC pauses

This is incorrect, you can have memory safety without a gc. An example is Ada, and more recently Rust.

Re:On Apple's Love Affair with Swift by comex on Saturday August 11, 2018 @06:56PM (#17741986)
And Swift, which uses automatic reference counting instead of GC. This is not a “zero-overhead” design like what Rust aims for; sometimes it has quite a lot of overhead. But it is free from the phenomenon of GC pauses.
Re:On Apple's Love Affair with Swift by pjmlp on Sunday August 12, 2018 @12:50PM (#17745189)
> But it is free from the phenomenon of GC pauses.

Not really. RC algorithms can lead to stop the world in cascade deletion of highly nested data structures, and even cause stack overflow due to destructors being called.

Re:On Apple's Love Affair with Swift by icebraining on Saturday August 11, 2018 @08:06PM (#17742226)
Well, in that regard, so is Python; the GC is only used to resolve cycles, and can be disabled.
Re:On Apple's Love Affair with Swift by com2kid on Saturday August 11, 2018 @04:17PM (#17741306)
IIRC memory safe Ada doesn't allow for deallocation.

Kinda sorta cheating. ;)

Re:On Apple's Love Affair with Swift by pjmlp on Sunday August 12, 2018 @12:51PM (#17745195)
It does via memory pools, RAII (aka controlled types) and dynamic stack allocation.
Re:On Apple's Love Affair with Swift by com2kid on Tuesday August 14, 2018 @01:50AM (#17755854)
It isn't truly safe like Rust, as Ada can still have dangling pointers laying around, the free function is called "Unchecked_Deallocation", not sure if newer Ada has any mechanisms for better ownership semantics.
Re:On Apple's Love Affair with Swift by baby on Saturday August 11, 2018 @05:03PM (#17741528)
> People have written and continue to write secure C code, and insecure code in “safe” languages.

No. It's the inverse. People who are very good with C continue to have vulnerabilities in their code. Why? Because C.

Re:On Apple's Love Affair with Swift by pjmlp on Saturday August 11, 2018 @02:21PM (#17740874)
Yeah, but I do have data to back up the fallacy of the perfect C programmer that writes secure C code.

https://www.cvedetails.com/vulnerability-list/opmemc-1/memor...

Apparently reviewing code before merging into mainline isn't of much help, but lets keep this myth of secure C code alive.

Σ (Logic errors in safe language) < Σ(Logic errors in C + Memory Corruption in C)