On 08/28/2014 09:37 PM, Andrew Godfrey wrote:
> On Friday, 29 August 2014 at 02:10:46 UTC, H. S. Teoh via
> Digitalmars-d-learn wrote:
>> In D you just use '.' throughout and it Just > Works(tm).
>
> Unless the property you're accessing is also a pointer property, like
> sizeof. Then you have to
On Fri, Aug 29, 2014 at 05:28:12AM +, Andrew Godfrey via
Digitalmars-d-learn wrote:
> On Friday, 29 August 2014 at 05:05:55 UTC, H. S. Teoh via
> Digitalmars-d-learn wrote:
> >On Fri, Aug 29, 2014 at 04:37:37AM +, Andrew Godfrey via
> >Digitalmars-d-learn wrote:
> >>Unless the property you
On Friday, 29 August 2014 at 05:05:55 UTC, H. S. Teoh via
Digitalmars-d-learn wrote:
On Fri, Aug 29, 2014 at 04:37:37AM +, Andrew Godfrey via
Digitalmars-d-learn wrote:
Unless the property you're accessing is also a pointer
property, like
sizeof. Then you have to be careful.
True. Though
On Fri, Aug 29, 2014 at 04:37:37AM +, Andrew Godfrey via
Digitalmars-d-learn wrote:
> On Friday, 29 August 2014 at 02:10:46 UTC, H. S. Teoh via
> Digitalmars-d-learn wrote:
> >In D you just use '.' throughout and it Just Works(tm).
>
> Unless the property you're accessing is also a pointer pr
On Friday, 29 August 2014 at 02:10:46 UTC, H. S. Teoh via
Digitalmars-d-learn wrote:
In D you just use '.' throughout and it Just > Works(tm).
Unless the property you're accessing is also a pointer property,
like
sizeof. Then you have to be careful. The below prints 4 then 8
(on 32-bit):
un
On Wednesday, 27 August 2014 at 19:25:42 UTC, Gary Willoughby
wrote:
I've taken a look in the std lib and the second form is used a
lot. Why don't you need to dereference the pointer 'foo' to
reach its member 'bar'?
Walter didn't want "foo->bar" so we have "foo.bar"
On Wednesday, 27 August 2014 at 19:36:08 UTC, Brian Schott wrote:
On Wednesday, 27 August 2014 at 19:25:42 UTC, Gary Willoughby
wrote:
Why don't you need to dereference the pointer 'foo' to reach
its member 'bar'?
The compiler inserts the dereference for you. (It knows which
types are referen
On Wednesday, 27 August 2014 at 19:25:42 UTC, Gary Willoughby
wrote:
Why don't you need to dereference the pointer 'foo' to reach
its member 'bar'?
The compiler inserts the dereference for you. (It knows which
types are references and which are values and can do this
correctly) This makes the
On Wed, Aug 27, 2014 at 07:25:41PM +, Gary Willoughby via
Digitalmars-d-learn wrote:
> This is something that has been on my mind since i discovered this the
> other day. Does D provide automatic dereferencing for accessing
> members through pointers?
[...]
Yes it does.
This is par
This is something that has been on my mind since i discovered
this the other day. Does D provide automatic dereferencing for
accessing members through pointers?
Here's an example:
import core.stdc.stdlib : malloc, free;
struct Foo
{
public int bar;
}
void main(string[]
10 matches
Mail list logo