Well my point is not that in C++ they aren't the same (they are) but
that logically they should NOT be the same. If I am passing the
address of an integer variable it SHOULD be different than passing an
array of integers. This would allow the compiler to be more strict and
find more errors, etc. There is a lot of published work on this on
topic and on the topic of theoretical OO languages. C++ was the first
OO language that let me write real PC languages and was my second OO
language after Small Talk. I have used Object C, Object Pascal, Java,
Eiffel, Modula II among OO languages. I have also dealt with a large
amount of C, Pascal, ASM, etc. Anyway, back on topic, I am a firm
believer that when the language is strongly type, statically linked and
with a more "rigid" syntax, it simply works better for large scale,
group oriented projects.
Now, while I know I am coming on strong with my opinions, I fully
realize it is only my opinion, and certainly do not get offended if any
disagrees with my position. After all, more intellectual transfer occur
between people with different opinions than from people in the same
ideological camps!
I hope that everyone has enjoyed the conversation and discussion as
much as I have, and that i haven't permanently offended anyone! :)
Thank you,
Alex Lindsay
On Sep 30, 2005, at 1:22 PM, Brad Hutchings wrote:
Array notation is nothing but syntactic sugar. It's a base address +
an offset into a block of uniformly sized memory blocks. Nothing in
the language absolves you of the responsibility to stay in the bounds
of what the compiler allocates for the array on the stack, or you
explicitly allocate in the heap.
My bet is that Will was a CS major. This is the kind of trivia that
makes a good quiz question in a lower division "programming" class.
But, as we now have operating systems that keep programmer mistakes
with this stuff from hurting the whole system, having a real
understanding of what's going on is probably a waste of most
developer's time.
-Brad
On Sep 30, 2005, at 10:37 AM, Will Leshner wrote:
Ok, again this is for the benefit of our listeners, but (and this is
more a general C thing than anything specific to C++) pointers and
arrays are really just two ways to say the same thing in C. In fact,
I'd go so far as to say that array notation is just syntactic sugar
for pointers. I would expect that most compilers would generate the
same code for both.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|