Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It's C and Python, not C++


All squares are rectangles I guess.


C can be used in C++ code, no?


It is true that there is C code that is conforming C++ code. However I would say if you’re using a C compiler with with “extern C” in the headers for C++ linker compatibility (as this library does) then saying C++ is about as misleading as saying a Rust library is C++ as you can link to that too.

As far as compatibility and “history” the languages are different enough now. There are both: features in C that do not exist in C++, and code that is conforming C that would be UB in C++. Saying C/C++ (for real) is usually a dumb target when it’s better to pick one and settle with that.

If it’s C, just say so. Everyone knows what extern C is, you don’t need to confuse.


Even Pascal is closer to C than C++ is, yet historically people use this term implying they are very close.


Something very close, but that's not what you would expect for something that markets itself as a C++ library IMHO. Especially in 2024, most people would hope (or assume) that "C++" means "C++ 11" at least.

Definitely doesn't count as _lying_, but still underwhelming.


Yes. And C can also be used with Python and Rust. That does not make this a Rust library.


Right, but C++ started as an extension of C and is mostly compatible and historically you could compile C with the C++ compiler. I don't think it's a good comparison.


Zig can compile C. That makes this C/C++/Zig library. Right? :^)


> historically you could compile C with the C++ compiler.

not any C, only the C++-compatible subset.

    int* foo = malloc(sizeof(int)); 
has never worked in C++ for instance while it's valid C. Code that worked is code that people actually did effort to express in a way compatible with a C++ compiler.


  #ifdef _cplusplus
      #include <iostream>
      #define print() int main(){cout << "Hello world! -- from C++" << endl;}
  #elif (defined __STDC__) || (defined __STDC_VERSION__)
      #include <stdio.h>
      #define print() int main(){printf("Hello world! -- from C\n");}
  #else
  import builtins
  print = lambda : builtins.print("Hello world! -- from Python")
  #endif
  
  print()
Some python code works in C and C++ as well but people don't group them together and call Python/C/C++


You must admit that C/Python doesn't quite have the same cachet as C/C++. C & C++ also share the same name, C++ was born as a derivative of C (with classes), they have the same syntax, logical constructs etc. Python is not even a systems language.


Depends, not all C is C++, eg, there is no (yet) `restrict` keyword in C++ (even if lots of C++ compilers support __restrict__, it's not in the spec)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: