Hacker News new | ask | show | jobs
by misanthropian00 2123 days ago
I will continue to say C/C++. To me they are not distinct enough as languages to truly be considered fully separate and they use the same compilers. The fact that they use the same compiler is to me a devastating argument. No other distinct languages use the same compiler.

>A language is also its good practices, patterns, idioms

The usual argument, but I disagree. If programmers don't have freedom of expression then fuck programming. We should all be free to write our own programs the way we want and not have to worry about standard practices or cultures.

6 comments

By that reasoning you'd have to add:

- Ada, D, Delphi, Fortran, Haskell, Julia, Objective-C, Rust, and Swift (if you go by LLVM)

- Objective-C, Objective-C++, Fortran, Ada, and Go (if you go by gcc)

It is true that you should have the freedom to write code in any way you want. Thankfully employers have the freedom to reject your code if you don't follow their practices. Just like with freedom of speech, you have a right to say what you want without fear that the government will punish you, that doesn't mean you're shielded from what other people think of you.

yes! freedom! dangling pointers for everybody!

But seriously: I wish more programmers had really good background (I'm not talking about academia, but e.g. learning from many books and conference videos).

The "good practices" are often a set of ideas like "do it this way, so you won't suffer later". Nothing more. This way you can avoid mistakes made by others. Of course, you can do whatever you like and suffer later.

C is C. C++ is C++. If they are the same, well... why do they have different names?

Let's call them C/C++/Fortran OK? You can use one tool (you called it "one compiler", while in fact they are different compilers with common core) to rule them all, even in the same program... https://www.cae.tntech.edu/help/programming/mixed_languages.

I'd love to see more programmers naming things with care. This way we would have C, we would have C++. But also we would have MB when talking about megabytes, not mb (millibits, is that even a thing?).

If surgeons would have freedom to do things the way they want... in fact they have the freedom, but they rather follow the "good practices" made mainly by the retrospection after someone made a tragic mistake. But if they really would do whatever they want... let's not talk about it for now, OK?

> The fact that they use the same compiler is to me a devastating argument.

GCC can also compile Ada. Would you say C/C++/Ada is a single language?

While I agree with C/C++ term as shorthand for "C and C++" as it is widely used across ISO papers, C++ books and FAANG official documentation, I don't care about C and ISO C++ doesn't require C++ compilers to also bundle a C compiler in the package.

That is an historical accident of C compiler vendors adopting C++ and C++ being also a language out of Bell Labs.

> To me they are not distinct enough as languages to truly be considered fully separate

There are plenty of subtle differences, precisely because they aren't the same language. [0][1] They're deeply connected, but there are important differences between them, and it doesn't do to gloss over the details. For instance, empty structs are permitted in C++ but might get you into trouble in C. [2]

> they use the same compiler

Many of the major compiler suites support lots of different languages. You can compile Fortran, C, and C++ code using LLVM, GCC, ICC, or even OpenWatcom. So what?

It's true that where you find a C++ compiler, you generally find a C compiler, but the converse does not hold. The TCC C compiler doesn't support C++, for instance. The same goes for many of the more obscure C compilers out there.

Also, sometimes a compiler suite will have solid support for C++ but poor support for C. If you want to do modern C++ programming on Windows you might use MSVC, but MSVC has surprisingly awful support for C. [3]

> We should all be free to write our own programs the way we want and not have to worry about standard practices or cultures.

Disagree. It can improve quality to use strict coding-standards and a strict language. Software development is not about maximising creative freedom, it's about effectively developing high-quality solutions, see [4]. This is the reason software in safety-critical domains like avionics is never free-form, it invariably uses highly restrictive coding-standards like MISRA C, or highly restrictive languages like SPARK Ada.

(Hope that wasn't too off-topic, my points there don't pertain whether a 'language' should be understood to include its conventions.)

[0] https://en.wikipedia.org/wiki/Compatibility_of_C_and_C%2B%2B

[1] https://stackoverflow.com/a/21515839/

[2] https://stackoverflow.com/a/755339/

[3] https://github.com/MicrosoftDocs/cpp-docs/issues/407

[4] https://www.fastcompany.com/28121/they-write-right-stuff

> The fact that they use the same compiler is to me a devastating argument.

Except they don't.