3 ms·
>C99 has variable length arrays But they don't give C any power C++ doesn't have. In terms of expressive power, you have things like std::vector, and in terms
by sjolsen 12y ago
>C99 has variable length arrays
But they don't give C any power C++ doesn't have. In terms of expressive power, you have things like std::vector, and in terms of performance, everyone except MSVC supports VLAs in C++ anyway, and MSVC doesn't even support them in C.
>How do I play to its ABI compatiblity strengths? Because I have to keep wrapping all of it in extern "C" declaration in a large enough system.
That is playing to its ABI compatibility strengths. In how many other languages is binary compatibility so simple?
Regardless, no one said anything about ABI compatibility being one of C++'s strengths. The point was about using C++'s template system for, of all things, exactly what it was designed to do.
- rdtsc 12y ago> , you have things like std::vector, and in terms of performance, everyone except MSVC supports VLAs in C++ anyway, and MSVC doesn't even support them in C. They are not the same. VLA in C are on the stack vectors are allocated from dynamic memory (heap). > Regardless, no one said anything about ABI compatibility being one of C++'s strengths. Right but that is why in practice C++ it is not a strict superset of C. When having to interface with other parts of the systems (loading .so, .dlls) or integrating with scripting langauges, the interface still has to be wrapped in a C interface.
- sjolsen 12y ago>They are not the same I didn't say that they were. I said that they were equally expressive, because the claim was that C++ is more powerful than C. >VLA in C are on the stack vectors are allocated from dynamic memory (heap) That is not necessarily true. It's an implementation detail, and as far as it's relevant, so is the fact that everyone supports VLAs in C++. >Right but that is why in practice C++ it is not a strict superset of C Nobody said that C++ was a strict superset of C. The claim was that C++ is more powerful than C, and the fact that you have to specifically request ABI compatibility is not evidence to the contrary. Rather, the fact that you can do this at all (and that you can't use C++ linkage in C) is evidence in support of it.