News for hackers. Stuff that matters.
Re:GNU Coding Standards: Writing Robust Programs by cng100 on Friday June 11, 2021 @07:41AM (#27471959)
The average C++ code base has as many segfaults than the average C code base.

Windows has more exploits than Linux. But you know all that, so I wonder why you keep making these statements, which are then upvoted by the "memory-safe" crowd.

Re:GNU Coding Standards: Writing Robust Programs by krychu on Friday June 11, 2021 @08:34AM (#27472438)
I’m glad this doesn’t go unnoticed, and share the observation. There seem to be quite some effort going into creating illusions of truth about C. Just a personal observation.
Re:GNU Coding Standards: Writing Robust Programs by pjmlp on Friday June 11, 2021 @10:16AM (#27473658)
Re:GNU Coding Standards: Writing Robust Programs by yjftsjthsd-h on Friday June 11, 2021 @11:54AM (#27474953)
If you want to play that game, https://www.cvedetails.com/product/32238/Microsoft-Windows-1... shows Windows, indeed, having more CVEs, in spite of, AFAIK, not using C (substantially, at least). Of course, the real problem is that CVE counts may or may not mean anything when comparing systems with wildly different development models (FOSS/proprietary) used mostly in different areas (desktop / everything else).
Re:GNU Coding Standards: Writing Robust Programs by jcelerier on Friday June 11, 2021 @07:54AM (#27472076)
> The average C++ code base has as many segfaults than the average C code base.

any source for that ? I find segfaults utterly rare in C++ >= 11

Re:GNU Coding Standards: Writing Robust Programs by __s on Friday June 11, 2021 @08:00AM (#27472125)
You were using C++ >= 11 in 90s/00s?
Re:GNU Coding Standards: Writing Robust Programs by ondrasej on Friday June 11, 2021 @08:24AM (#27472336)
I can't speak for the parent, but I've been using RAII and smart pointers in the 00s and it provided a lot of the benefits that got standardised with C++11.
Re:GNU Coding Standards: Writing Robust Programs by varjag on Friday June 11, 2021 @08:25AM (#27472343)
None of that was a thing in 90s and early 00s.
Re:GNU Coding Standards: Writing Robust Programs by ectopod on Friday June 11, 2021 @09:12AM (#27472846)
RAII and smart pointers definitely were a thing in the 90s. I wrote lots of COM code using these techniques. According to wikipedia, RAII was invented in 1984-89.
Re:GNU Coding Standards: Writing Robust Programs by jcelerier on Friday June 11, 2021 @08:38AM (#27472467)
The average C++ codebase isn't from the 90s. On all the recent c++ polls the average language revision used is between c++14 and 17.

Besides I'm pretty confident that there are more new c++ projects created daily in 2021 than monthly at the peak of the 90s c++ craze - just on GitHub, 6/7% of C++ repos means a few million recent C++ repos.

Re:GNU Coding Standards: Writing Robust Programs by dagw on Friday June 11, 2021 @09:17AM (#27472891)
I've worked on several code bases that nominally are C++11 or 14. However they still contain a lot of code written by people still coding like it's the 90s.
Re:GNU Coding Standards: Writing Robust Programs by varjag on Friday June 11, 2021 @10:57AM (#27474270)
What does it have to do with what we are discussing?
Re:GNU Coding Standards: Writing Robust Programs by jcelerier on Friday June 11, 2021 @11:34AM (#27474726)
we are discussing the sentence "The average C++ code base has as many segfaults than the average C code base."

__s and you said "You were using C++ >= 11 in 90s/00s?" to which I answered that this was not the point, because the average C++ code base isn't from the 90s/00s.

Re:GNU Coding Standards: Writing Robust Programs by secondcoming on Friday June 11, 2021 @11:39AM (#27474789)
> On all the recent c++ polls the average language revision used is between c++14 and 17.

Polls of hobbyist coders, or software houses? I would be surprised if most software houses migrated to C++17 yet. Tensorflow is stuck on C++03 I think.

Re:GNU Coding Standards: Writing Robust Programs by jcelerier on Friday June 11, 2021 @01:11PM (#27475935)
TF is at least C++11 from the first header I opened in the repo: https://github.com/tensorflow/tensorflow/blob/master/tensorf...

I'm referring to e.g. the Jetbrains and cppcon polls.

https://blog.jetbrains.com/clion/2020/06/dev-eco-cpp-2020/

https://youtu.be/JYzDpXI-vWI?t=137

Re:GNU Coding Standards: Writing Robust Programs by secondcoming on Friday June 11, 2021 @01:32PM (#27476195)
Last time I used it there was faff around having to define __GLIBCXX_USE_CXX11_ABI=0
Re:GNU Coding Standards: Writing Robust Programs by jcelerier on Friday June 11, 2021 @01:59PM (#27476531)
it does not mean that you're not using C++11. This macro is just a compatibility flag for your code to work on old linux distros that provide a C++11 compiler but did not want to rebuild their whole archive. It mainly means that std::string is implemented with copy-on-write instead of small buffer optimization.
Re:GNU Coding Standards: Writing Robust Programs by pjmlp on Friday June 11, 2021 @10:17AM (#27473668)
Sure it was, Borland and Microsoft compilers already had smart pointers for COM libraries.

Besides even on MS-DOS with frameworks like Turbo Vision, RAII was a common pattern.

Re:GNU Coding Standards: Writing Robust Programs by antoinealb on Friday June 11, 2021 @09:15AM (#27472873)
auto_ptr (precursor to unique_ptr) was first proposed for standardisation in 1994 [0], and there was probably non standard versions of it before 94.

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/1994/N055...

Re:GNU Coding Standards: Writing Robust Programs by mcguire on Friday June 11, 2021 @10:42AM (#27474039)
You ever used auto_ptr?

In 1992, I was working on the Taligent project, probably the first major C++ operating system. (It failed.) I remember when the ARM came out---none of the compilers we had available could really do templates. Or namespaces.

Re:GNU Coding Standards: Writing Robust Programs by prpl on Friday June 11, 2021 @11:16AM (#27474504)
A part of Taligent lives on with ROOT, which was very annoying.
Re:GNU Coding Standards: Writing Robust Programs by touisteur on Friday June 11, 2021 @01:57PM (#27476504)
Oh no... ROOT. It's a testament to the pure grit and gumption or thousands of poor undergraduates that particle physics can advance, with this. Eons ago, I tried several times to help my then-girlfriend (you know how it goes 'hey you have some kind of eng diploma'? Yes sw engineering... - Hu so you know C++? - nobody 'knows' C++ but I can manage 'so here what I'm trying to do, here are 3 other examples, please for the love of Wotan help') and I was baffled on how to do anything with it. I mean the core thing seems powerful enough, but trying to go out of the beaten path (research, right ?) was yugely frustrating... And I'd worked on 2 physics codebases or variable quality before. I didn't appear as competent as I'd hoped and spent so much time helping, reading docs and code without understanding much of the design. This is the codebase that started my deep defiance for OOP and especially OOP-as-a-mirror-of-the-real-world and inheritance-for-code-economy...
Re:GNU Coding Standards: Writing Robust Programs by marrs on Friday June 11, 2021 @10:24AM (#27473784)
ok then, nobody was using auto_ptr in the 90s.
Re:GNU Coding Standards: Writing Robust Programs by pjmlp on Friday June 11, 2021 @10:37AM (#27473956)
Oh boy, OWL, MFC and VCL were used in the 90s, with their ComPtr smart pointer for COM/ActiveX/OLE 2.0.
Re:GNU Coding Standards: Writing Robust Programs by varjag on Friday June 11, 2021 @10:50AM (#27474166)
I worked with C++ & MFC in mid-late 1990s, smart pointers weren't an option. Maybe if you do something against MS oddball APIs, but not in general programming, not even for mainstream MFC uses. And what was there was entirely non-idiosyncartic, it's like claiming C++ had garbage collection in 1990s because you could bolt on Boehm's.