4 ms·
It's C and Python, not C++
by dekken_ 2y ago
It's C and Python, not C++
- dsego 2y agoC can be used in C++ code, no?
- Galanwe 2y agoSomething 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.
- dekken_ 2y agoDepends, 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)
- bregma 2y agoYes. And C can also be used with Python and Rust. That does not make this a Rust library.
- dsego 2y agoRight, 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.
- codetrotter 2y agoZig can compile C. That makes this C/C++/Zig library. Right? :^)
- jcelerier 2y ago> 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.
- epcoa 2y agoIt 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.
- leonardohn 2y agoEven Pascal is closer to C than C++ is, yet historically people use this term implying they are very close.
- shultays 2y ago#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++
- dsego 2y agoYou 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.
- textlapse 2y agoAll squares are rectangles I guess.