<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2013/4/2 <<a href="mailto:luismarques@gmail.com">luismarques@gmail.com</a>>"@<a href="http://puremagic.com">puremagic.com</a> <span dir="ltr"><<a href="mailto:"\"Luís".Marques"" target="_blank">"\"Luís".Marques"</a>></span><br>
<blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="im">
On Tuesday, 2 April 2013 at 02:52:48 UTC, Steven Schveighoffer wrote:<br>
<blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
You see, indexing does NOT dereference the pointer, it's an index for that pointer.  c[0] means *(c + 0).  A pointer is essentially an unchecked slice, with undefined length.  This is how it works in C also.<br>
<br>
c[1] is the same as *(c + 1), completely consistent (and also sets b to 42, 42)<br>
</blockquote>
<br></div>
OK, I think I see where I went astray. I was a case of bad induction from a few tests :-)<br>
So, I guess what is happening is the following, right?<br>
<br>
    int[2] a;<div class="im"><br>
    int[2] *c;<br>
    c = &a;<br>
<br></div>
    c[0] = 7;  // same thing as below<br>
    a = 7;      // same thing above<br></blockquote><div><br></div><div>These are doing that element-wise assignment.</div><div><br></div><div>    c[0][] = 7;  // same as c[0][0] = c[0][1] = 7;</div><div>    a[] = 7;      // same as a[0] = a[1] = 7;</div>
<div><br></div><div>As a side note:</div><div>From 2.063, lack of [] for array operation would be warned with -w switch.</div><div> <br></div><div>So, there is no "implicit dereferencing". </div><div><br></div><div>
Kenji Hara</div></div></div></div>