Live data from Hacker News

GNU Coding Standards: Writing Robust Programs

gnu.org

51–60 of 111 posts

Re: GNU Coding Standards: Writing Robust Programs

#52
post #39

Earlier quoted context omitted.

Would you say that the predominance of C++ rather than C in FLOSS would have a net positive result?

Yes, because while it isn't fullproof due to copy-paste compatibility with C89, at least it offers better tooling for safer coding, provided one doesn't code "C with C++ compiler". Namely: - proper string and vector types (most compilers allow to enable bounds checking anyway) - stronger rules for type conversions - reference types for parameters - better tooling for immutable data structures - memory allocation prim…

I also have a copy of P. J. Plauger's Draft Standard C++ Library.

Re: GNU Coding Standards: Writing Robust Programs

#53
post #38

I see that they still say: >>> Please don’t use “win” as an abbreviation for Microsoft Windows in GNU software or documentation. In hacker terminology, calling something a “win” is a form of praise. You’re free to praise Microsoft Windows on your own if you want, but please don’t do so in GNU packages. Please write “Windows” in full, or abbreviate it to “w.” But they have removed some other guidance: >>> Instead of a…

GNU has always had that childish tinge to its writings. Chief GNUsance and all that.

This is exactly why I've never been on the GNU-train. The radicality of RMS's writings and philosophies paired with the subtle condescending and childish tone in all of the guides, licenses, articles, blog posts, etc.

Re: GNU Coding Standards: Writing Robust Programs

#54
post #27

I hate that formatting style personally.

Me too. I've never understood it. I just went back through the clang-format documentation and looked at some of the examples for the GNU style and was reminded at how utterly unreadable the resulting code is.

Re: GNU Coding Standards: Writing Robust Programs

#55
post #45

Earlier quoted context omitted.

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...

ok then, nobody was using auto_ptr in the 90s.

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

#56
post #43

Earlier quoted context omitted.

On the contrary, - proper string and vector types (most compilers allow to enable bounds checking anyway) - stronger rules for type conversions - reference types for parameters - better tooling for immutable data structures - memory allocation primitives instead of getting sizeof wrong to malloc() - collection library instead of reinventing the wheel in each project - RAII - smart pointers - templates instead of erro…

All of which were heavy enough at the time to slow programs down enough that people chose to not use them in favor of faster, more portable C.

That is why Turbo Vision was written in C++ for MS-DOS, Mac OS transitioned from Object Pascal into C++ and Quake made use of Watcom C++.

Re: GNU Coding Standards: Writing Robust Programs

#57
post #47
post #43

Earlier quoted context omitted.

On the contrary, - proper string and vector types (most compilers allow to enable bounds checking anyway) - stronger rules for type conversions - reference types for parameters - better tooling for immutable data structures - memory allocation primitives instead of getting sizeof wrong to malloc() - collection library instead of reinventing the wheel in each project - RAII - smart pointers - templates instead of erro…

I'm more interested in the the actual statistics for security vulnerabilities found in C vs. C++ programmes, rather than theoretical benefits one language might have over the other.

Any C++ vulnerabiliy caused by copy-paste compatibility with C is by definition a C vulnerabiliy.

Re: GNU Coding Standards: Writing Robust Programs

#58
post #46
post #12

Earlier quoted context omitted.

In part yes. Had GNU/Linux not taken off, in the alternative universe from Windows, BeOS, Mac OS, OS/2, commercial UNIX (remember Motif++ and CORBA?) would kept writing the software in C++, instead of caring about creating FOSS stuff in C. GNOME vs KDE is a good example of that schism and language wars.

I remember CORBA. Oh, god, do I remember CORBA. I wish I could forget CORBA.

It is called gRPC nowadays.

Re: GNU Coding Standards: Writing Robust Programs

#59
post #21

Earlier quoted context omitted.

None of that was a thing in 90s and early 00s.

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...

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

#60
post #3

> When you want to use a language that gets compiled and runs at high speed, the best language to use is C. C++ is ok too, but please don’t make heavy use of templates. So is Java, if you compile it. Back in the early days, this sentence was more like "When you want to use a language that gets compiled and runs at high speed, the best language to use is C." . So we switched from a path where all major desktop environ…

> So here we are now, about 30 years later, trying to fix the security inconveniences caused by this manifesto.

That sounds backwards to me. It wasn't a "manifesto" that caused that "surge", it was the actual software being written.

Free software beat the world. Free (system) software is overwhelmingly written in C. At least part of an argument like this needs to nod to the fact that free software written in C beat the world because... C was a better choice? Certainly it was in the 90's.

Post reply on HN