New slides about Go
Michel Fortin
michel.fortin at michelf.com
Fri Oct 15 04:14:06 PDT 2010
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.
--
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/
More information about the Digitalmars-d
mailing list