I know, pints is declared as a pointer to const int, while ints is declared as an array of const int. But shouldn't the compiler be smarter? It knows that pints was assigned with the value ints... why doesn't it use this information - instead of the static type info?
How can I find out the extent of the native array in the following code:
By keeping track of it yourself, or using a type (like std::vector, for instance) that does it for you.
I know, pints is declared as a pointer to const int, while ints is declared as an array of const int. But shouldn't the compiler be smarter? It knows that pints was assigned with the value ints... why doesn't it use this information - instead of the static type info?
In general, "this information" is not always available to the compiler. Should it behave one way when it is and another when it isn't? Do you really want your compiler guessing what you want instead of behaving deterministically?