4 ms·
There is no language called "C/C++". If, to use it, you need C++, it's a C++ system, period. If parts are in C, that is an implementation detail, and is furthe
by moloch-hai 4y ago
There is no language called "C/C++".
If, to use it, you need C++, it's a C++ system, period. If parts are in C, that is an implementation detail, and is furthermore pointless; modernizing those to C++ would make them more robust and probably faster. Using C anywhere just makes it as bug-prone in those parts as C code everywhere is.
- MaxBarraclough 4y ago> If, to use it, you need C++, it's a C++ system, period. If parts are in C, that is an implementation detail C and C++ are different languages, you can't necessarily treat a codebase of mixed C and C++ as if it were written entirely in C++. This isn't purely academic, either. For a long time the MSVC compiler had pretty good C++ language support but surprisingly poor C support, which inconvenienced some folks. > modernizing those to C++ would make them more robust and probably faster I agree that adopting C++'s insistence on explicit type conversions is a good move for C codebases. I'd be surprised if performance were improved by reworking a C codebase to get it to compile as C++, though.
- moloch-hai 4y agoYou can, in fact, compile the C code with a C++ compiler, given trivial adjustments. Adopting "explicit type conversions" would have similarly trivial results. The benefits would come from leaning into higher-level organization. C++ code going faster than the C is routine. It doesn't come without activity, but the activity yields a more maintainable system, so is commonly done. MSVC's C compiler only recognized C90. It was generally easier to make your C99 code compile as C++ than to backport it to C90.
- kgwgk 4y ago> There is no language called "C/C++". He clearly means that he used two languages: C and C++. "I decided to reimplement the inference of the model from scratch using C/C++. To achieve this I implemented a minimalistic tensor library in C and ported the high-level architecture of the model in C++."
- moloch-hai 4y agoIt is obvious what he did just from reading what he wrote, after. It is not clear that he meant anything at all by the expression. You cannot use his thing in any but a C++ program, so mentioning C at all only adds confusion.
- kgwgk 4y agoIt is clear what he meant by the distiction: implemented a minimalistic tensor library in C ported the high-level architecture of the model in C++ The C part - which accounts for most of the lines of code - may be of interest to someone who wants to use it as the foundation for implementing a different model - not necessarily in C++
- mh7 4y ago>There is no language called "C/C++". Yes there is. Take the union of C and C++ which is valid syntax (and same semantics) in both languages, voila; C/C++.
- moloch-hai 4y agoBut it is not, in fact, written in such a "language". Nothing is.