In visual studio, you can hover over the Auto datatype and see what datatype the compiler chooses for it. I haven't found a way to do this in xcode and would like to because with some of the larger code bases I have been working in, it becomes a point of confusion.
Asked
Active
Viewed 297 times
2
-
Option+click (Alt+click) – Yonat Dec 23 '18 at 16:34
-
You might also be able to use `typeid().name()` if you want the type at run time – William Miller Dec 23 '18 at 17:01
-
1Top tip: if using `auto` makes it hard to know what type something is, and you need to know what type the thing is, you shouldn't be using `auto` in that place. – Lightness Races in Orbit Dec 23 '18 at 17:08
-
1Top tip #2: if you need an IDE feature to understand your code, the code requires simplifying and/or more comments. – Lightness Races in Orbit Dec 23 '18 at 17:08
-
1@Yonat - option+click opens a box that says No Quick Help, with a button to search documentation. – Max Throughput Dec 23 '18 at 17:52
-
I'm using something like this https://stackoverflow.com/a/46339450/8494588 to display some types oft interest in a compiler error. – florestan Dec 23 '18 at 22:36
-
1It's a kludge, but I typically add the line `int i = autovariable;`. This generates an error about being unable to convert from Foo to int, so now I know that `auto` evaluated to `Foo` – Edward Falk May 11 '22 at 19:25