Live data from Hacker News

Writing New System Software

borud.no

131–140 of 158 posts

Re: Writing New System Software

#131
post #119
post #67

Earlier quoted context omitted.

I guess we can consider AOSP legacy code then, given how they use C++.

Yes. Legacy in every sense, including "abandonware".

Educate yourself on Android source code.

You can even start by the new entries related to Rust.

https://source.android.com/setup/build/rust/building-rust-mo...

Re: Writing New System Software

#132
post #66

The Rust propaganda is getting more subtle I see ;) It's only mentioned once towards the end of the post together with Go and Java. What a clever disguise.

Strange language choices for a Rust propagandist's GitHub repositories: https://github.com/borud?tab=repositories

As we know from stack overflow survey, rust is most loved and one of least used language, no surprise here!

Re: Writing New System Software

#133
post #111

Earlier quoted context omitted.

It reads like the notes for an article. It says everything the author is thinking but doesn’t give the context necessary to understand their thinking.

Anywhere somebody says "C/C++" in the context of system programming, you can stop reading right there without missing out on anything. tl;dr: C and C++ have cooties, use literally anything else. Nothing to see here.

> C/C++ projects and build systems in Visual Studio

https://docs.microsoft.com/en-us/cpp/build/projects-and-buil...

> IBM Open XL C/C++ for AIX and XL C/C++ for AIX documentation library

https://www.ibm.com/support/pages/ibm-open-xl-cc-aix-and-xl-...

Re: Writing New System Software

#134
post #117
post #44

Earlier quoted context omitted.

Not when stepping through code in gdb/lldb in my experience in debug builds: they very often end up stepping in to the -> operator implementation for functions, which then requires me to step in again to get to the actual function call I wanted.

Measuring overhead of debug builds is a rookie mistake.

I'm not talking about code performance, I'm talking about human time of having to step through extra things while using a debugger to work out what's going on.

Re: Writing New System Software

#135
post #113

Earlier quoted context omitted.

> chrome See https://www.cvedetails.com/vulnerability-list/vendor_id-1224... for a list of RCE vulnerabilities. I see a bunch of memory management problems there. Also note that chrome is likely much better tested than some other C++ project, and lots of tools are used to search for potential vulnerabilities or invalid memory use as well as fuzzing and crash reports from a large install base. I don’t know how this co…

Chrome is not coded in anything even slightly resembling modern C++. So, no conclusions about modern C++ can be drawn from it. Except, maybe, that it takes a long time to modernize old code.

I’m merely trying to respond to a comment that claims that chrome should have few memory management bugs. I don’t really have an opinion about whether it is modern. I don’t care enough about the distinction between C++ styles to know where to find evidence of the rate of memory management problems in modern C++ codebases. Perhaps I would just find that the definition of modern C++ is ‘the style of C++ where you don’t write code with memory management bugs’ (I.e. if I were to try to find an example it would not be a true Scotsman)

Re: Writing New System Software

#136

Earlier quoted context omitted.

> chrome See https://www.cvedetails.com/vulnerability-list/vendor_id-1224... for a list of RCE vulnerabilities. I see a bunch of memory management problems there. Also note that chrome is likely much better tested than some other C++ project, and lots of tools are used to search for potential vulnerabilities or invalid memory use as well as fuzzing and crash reports from a large install base. I don’t know how this co…

Never contain programs so few bugs, as when no debugging tools are available - Niklaus Wirth Fuzzers and testing can detect bugs but I don't see how they can make a contribution to a reasonable software structure (I believe that bad structure is the prime cause of bugs).

The other tools being talked about are static analysis tools or runtime instrumentation both designed specifically to try to find bad memory use patterns.

I don’t mean this in a rude way, but I don’t care what you believe, because the thing I care about is evidence. If you have some actual evidence for your claim, I would be interested. (I also believe there can be improvements from better code structure in a rewrite and this can make up for a significant portion of the improvements from a ‘let’s rewrite it all in rust’ project).

Re: Writing New System Software

#137
post #108

Earlier quoted context omitted.

I don’t understand what you’re trying to say? Do you mean that you don’t call malloc? Because that is totally not the point. For example, you could create a new object, pass a reference to it to some function that stores it in a hash table, reach the end of your function where the object is automatically deleted, and then have something try to read the object out of the hashtable. Nowhere do you need to call malloc o…

>"For example, you could create a new object, pass a reference to it to some function that stores it in a hash table, reach the end of your function where the object is automatically deleted, and then have something try to read the object out of the hashtable." Emplace constructs copy of object in the container. You should be fine.

What are you trying to argue here? I’m not claiming that the thing I described is good, only that it is a way to get memory management wrong without calling malloc, so the fact that emplace exists is irrelevant. I think I still don’t understand what your point is because you seem to be arguing against something I’m not claiming.

Re: Writing New System Software

#139
post #108

Earlier quoted context omitted.

>"For example, you could create a new object, pass a reference to it to some function that stores it in a hash table, reach the end of your function where the object is automatically deleted, and then have something try to read the object out of the hashtable." Emplace constructs copy of object in the container. You should be fine.

What are you trying to argue here? I’m not claiming that the thing I described is good, only that it is a way to get memory management wrong without calling malloc, so the fact that emplace exists is irrelevant. I think I still don’t understand what your point is because you seem to be arguing against something I’m not claiming.

If you are actively looking to shoot yourself in a foot be my guest. But it is your problem, not the one of the language.
Post reply on HN