2 ms·
> What's wrong with declaring int i at the top of your function (like old-style C) and then using it throughout all loops in the function? Ask Stroustrup. It's
by tgv 4y ago
> What's wrong with declaring int i at the top of your function (like old-style C) and then using it throughout all loops in the function?
Ask Stroustrup. It's his example, and in this case avoidable.
> You can't just cull old variadic functions because some old stuff won't work.
Yes, you can. They've removed quite a few features from older C++ versions. You can turn them back on, if you want. So for C++x24 or whatever, they could say: for loop variables are always local, C variadic is no longer permitted, etc., and use some compiler flag to re-enable it.
> It also isn't in Bjarne's hands
But that's probably the person with most influence on the language. And if he would propose a C++safer version, which deviates from the standard by eliminating as many bad practices as he sees fit, people would follow, and the two would probably merge at some point.
But that won't happen, which makes the core guidelines a bit of a joke. "Here's an apple. Don't eat it."
- 72deluxe 4y agoGood points. I myself would be happy to see va_args disappear but it'd require work from the maintainers of the compilers etc. which is unlikely to get support, I guess?