R
Richard Herring
Brad Herald said:Course webpage (http://courses.cs.vt.edu/~cs1704/fall03/)
I know this instructor who put this together agrees concisely with other
professors as to the validity of the notes below.
Argumentum ad numerum.
I know he has programmed
in C++ for many years as well as his colleagues.
Argumentum ad verecundiam.
I learned a lot of C++
from this instructor.
Argumentum ad misericordiam ;-)
Perhaps if Mr. Stroustrup were to visit and correct a misperception about
arrays and pointers.
Anyway, an excerpt (below) is from the course notes at the following link.
http://courses.cs.vt.edu/~cs1704/fall03/Notes/C03.Pointers.pdf
Pointer Expressions
Arrays == Pointers
Is simply wrong, unless "==" means "can be converted to".
- Non-indexed Array variables are considered pointers in C
"are considered [under some circumstances]" does not equate to "are".
- Array names as pointers contain the address of the zero
element (termed the base address of the array).
That "as pointers" rather begs the question.
Why not simply and accurately say, as does ISO/IEC 14882 4.2/1,
'An lvalue or rvalue of type "array of N T" can be converted to an
rvalue of type "pointer to T". The result is a pointer to the first
element of the array.'
?