Re: Re: C++20+
By: feoh to All on Fri Feb 06 2026 06:04 pm
auto seems SUPER compelling and looks like it might take some of the drudgework out of using C++, at least for whimps like me who generally reach for gc languages like Python first.
I knew C++ pretty well in the 90s. Hopefully one of these days I can dust off those neurons and enjoy some of the newer features that have come along since I last checked.
The 'auto' keyword has been around in C++ since 2011 (added to the C++11 standard).
I've been using C++ a while (professionally since 2003, and started learning it in college in 1999-2000). I like many of the additions to C++ since the C++11 standard, though I feel like I still shy away from 'auto' sometimes. I see the usefulness of it, but I hesitate to use it liberally in my code. I think one of the strengths of C++ is that it's a strongly-typed language, and before 'auto', that meant you would know the type of all the variables just by reading the code. With 'auto', I think the code is a bit less readable, as you now need to look more closely at what the code is doing in order to determine what type it (probably) has.
There are also times when you really need a variable to have a specific type - For instance, if you're reading & writing audio data, you need a variable that's specifically a number of bits wide. At some point, you'd need to declare a variable with a specific type. Although higher up in the code, you could still use 'auto' (and I think that could be useful).
The 'auto' keyword helps in allowing the code to deal with changing return types. I think it's mostly useful if you're using a library function and that function's return type ends up being changed at some point.
Nightfox
---
þ Synchronet þ Digital Distortion: digitaldistortionbbs.com