Should we really use C over C++ when this sort of thing is considered good?

Should we really use C over C++ when this sort of thing is considered good?

Attached: 2018-03-12-123534_776x206_scrot.png (776x206, 19K)

VLAs and flexible array members are fantastic though.

What do you think of STL containers?

They're a mixed bag.
I hope you're not insinuating that std::vector is a replacement for an array though.

I claim that std::vector is almost certainly at least as good than a variable length array you would write youself (although you're probably a lovely person)

I see nothing wrong with this.
>t. modern C++ fag

VLAs aren't the same thing as vector. VLAs are a C99 feature, roughly like alloca.

C++ is useful if you are sharing the project with a team of over 200-300 Poojeets. C is good for personal stuff, and mission critical task.

Could you educate me? I thought that vectors are just VLAs with a bunch of functionality tacked on.

You've got it completely backwards.

VLAs allow you to allocate an array with a runtime size on the stack. You don't resize it after that (that would require heap allocations with malloc/realloc).

I understand, thanks. I always just use malloc with a pointer for that sort of thing

As the OP I officially retract my challenge but still believe C++ is to be preferred to C in most situations

Vector uses 64bit counter internally. Has anyone ever in the history of computing had that many elements put into a single vector? If no, why is it unchangeable default setting for all STL containers?

dude size_t lmao

Why? What C++ features are useful?

It is, but for anything embedded or application specific, which is almost all mission critical or safety critical software, you're going to use C if you're using a high level language software at all.

C (and C++) is a tool for professionals. Something like a blow torch. Idiots shouldn't play with it. We have idiot-proof languages for that (ruby, python, go, etc)

Operator overloading
Function overloading
Objects (POD structs are restrictive)
Real type safety (no void* abuse)
Real generic programming (templates)
Less function pointer abuse
Less Macro abuse
STL
RAII
references
rvalue references
namespaces (no more long names eg. library_a_do_function_verson_b() )
proper const (once again preventing macro abuse)
constexpr (don't have to be a template wizard anymore to do compile time calculations)

4kb ram ought to be enough for everybody

Agreed
+ smart pointers

>POD structs are restrictive
That wouldn't be a problem if C++ had actual macros, modules (w encapsulation) and UFCS.
>namespaces (no more long names eg. library_a_do_function_verson_b() )
So you write library::a_do_function()
lol

>Objects (POD structs are restrictive)
No, C++'s OOP model is terrible.
>Less function pointer abuse
I'm not sure what exactly constitutes abuse here. Function pointers are a perfectly sane feature, less harmful than C++'s own runtime polymorphism.
>STL
Full of misfeatures and bad design (e.g. maps)
>RAII
Shit. Heavy reliance on exceptions, constructors and destructors, move semantics. All of these suck for their own reason.
>references
Pointers work and are explicit like they should be.
>rvalue references
Fuck no, rvalue references and their collapsing rules are retarded.

Templates, constexpr and overloading are the only sane-ish C++ features.

Or you just write using declarations at the start of your source file.

operator and function overloading hell, whne you can't know what ++ even means anymore
objects are just pod structs with some things hidden from the programmer
composition is better than inheritance anyway
all this type safety is just one reinterpret_cast away from being useless
templates are basically another turing-complete programming language you have to learn
function pointer abuse is hidden behind a curtain you shouln't ever peek around - until something doesn't work
references are just pointers that the compiler checks are not set to null anywhere
namespaces cause name mangling that is implementation-dependent, which means ABI will never be stable

c11 has generics. basically all i miss compared to c++ are lambdas and sanely implemented namespaces.

>c11 has generics.
_Generic is closer to function overloadng than templates or generics.
>namespaces cause name mangling that is implementation-dependent, which means ABI will never be stable
What is Itanium?
Unless you're using MSVC, pretty much every compiler has used Itanium ABI for the past decade. Huge C++ libraries like Qt have no problem distributing shared objects with a stable ABI.

>Or you just write using declarations at the start of your source file.
bad practice

>You don't resize it after that (that would require heap allocations with malloc/realloc).
Or you would copy it into a new array on the stack. People are way too fast to use the heap

I guess that was covered under RAII