The following compiles:
int myArray[5] = {3};
const int (*s)[5] = &myArray;
'int myArray[5]' has a different type than 'int *myArray'. Sometimes the first type will be converted by the compiler to the second type. This conversion is sometimes called 'decay.' In this case 'decay' means loss of type information.
References:
C++ Templates by David Vandevoorde. Addison-Wesley, 2003.
http://cpptruths.blogspot.com/2005_06_01_archive.html
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment