Global const variables

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Oct 21 07:27:50 PDT 2014


On Tue, 21 Oct 2014 17:25:09 +0300
ketmar via Digitalmars-d-learn <digitalmars-d-learn at puremagic.com>
wrote:

> On Tue, 21 Oct 2014 13:43:29 +0000
> Solomon E via Digitalmars-d-learn <digitalmars-d-learn at puremagic.com>
> wrote:
> 
> > `b[0] = 8;` or `b[] = 8;` changes a. Printing the values for &a 
> > and &b shows they're different pointers, but (a is b) returns 
> > true. So I still have more to learn about how it does that.
> that's 'cause '&b' taking address of hidden "array structure", not
> the first array element, as in C. try 'a.ptr' and 'b.ptr' to get
> addresses of array elements.
p.s. '&(a[0])' and '&(b[0])' works too. parens are just for clarifying.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20141021/2e385ac1/attachment.sig>


More information about the Digitalmars-d-learn mailing list