New slides about Go

Max Samukha spambox at d-coding.com
Fri Oct 15 04:42:37 PDT 2010


On 10/15/2010 02:14 PM, Michel Fortin wrote:
> On 2010-10-15 04:49:19 -0400, Max Samukha <spambox at d-coding.com> said:
>
>> static S s;
>> ref S foo()
>> {
>> return s;
>> }
>
> Pointers are allowed in SafeD; pointer arithmetic is not. Taking the
> address of a static or global variable should be allowed. If this
> doesn't compile, you should report it a bug:
>
> static S s;
> S* foo()
> {
> return &s;
> }
>
> There's nothing unsafe about taking the address of a static or global
> variable since the pointer can never outlive the variable.
>

Ok, makes sense.



More information about the Digitalmars-d mailing list