#The case against Almost Always `auto` (AAA)

21 messages · Page 1 of 1 (latest)

vapid python
night bay
#
void Container::do_things() {
    auto chunk = search_for_chunk();
    add_extra_stuff_to_chunk(chunks);
    use_somehow(std::move(chunk));
}

was the 3rd line supposed to be chunkS?

night bay
#

the but feels weird inside a list

#

oh and

IDEs aren't alwasy available
misspell

#

nice text overall, especially the part about IDE

vapid python
night bay
#

in the example about vector it is stated that instead of auto, vec3d should be used
but later that it is fine to use auto s = sqrt(x) because We also understand that a sqrt function should return the same type as the input., doesnt it apply to the end - start too?

vapid python
#

in the p - q example, you cannot infer the amount of dimensions that the result has

night bay
#

okay and because it is scalar its small, cheap, numeric type so its fine to eg copy it instead of using ptrs/references

vapid python
#

yeah

#

I mean, if you use sqrt then you basically know you're getting a trivially copable numeric scalar result

#

anything else would be extremely confusing

exotic charm
#

I'm really happy you've written it down. Most of these are conclusions I've had on my own, but couldn't precisely formulate that. This article addresses all the issues that I have either encountered or have seen people complain about before

brave flower
#

One negative consequence of auto is that it hides whether have ownership over the objects involved.
is this a typo? or cannot i the english?

brave flower
#

aa

#

great article btw

#

still reading

vapid python