Well I've giv(ing)/(en) you muchos props anyway. Feel like a bit of a tit, but there you go I've learned something and hopefully anyone else slightly mislead who has kept quiet and not done their learning in public has learned something too ;-)
This last paragraph of yours was the moneymaker, because that's all I really needed to know to be won over:
The reason why char (&)[some_value] is an r-value is because it directly references the array, which can only in practice be used as an r-value. The reason why char[] in a parameter list is an l-value is because, again, it does not mean you are passing an array. It is syntactic fluff for passing a char*. Since char* is a non-const pointer, it is an l-value. What I find more strange than the concept of array pointers and references is the fact that char[] and char[some_size] in a parameter list don't mean what what people would expect them to, which only contributes to people's misunderstanding of arrays.
The foo struct was pretty cool too. Which corrected Lesson 2, I think. With the whole explanation of why a == &a - because a is the array structures first element and &a a reference to the array structure itself. Which are actually the same place. And it becomes an r-value because you can't change a structure of an array once it's been created.
[Edited by - paulecoyote on December 2, 2004 8:23:04 AM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement