Talk:DIP90

From D Wiki
Jump to: navigation, search
  • Typo under 'Fundamentals of scope':

The scope storage class ensures that the lifetime of a pointer/reference is a shorter of the lifetime of the referred object => is shorter than the

  • Missing Rule 5 referenced:
   scope int* a;
   int* b;
   scope int* c = a;      // Error, rule 5

I think this is now part of Rule 1.

  • Under 'Escaping via Return', 5th & 6th code blocks:
 T func(T* t) {
   return t; // ok
 }

Return type should be T*.

 T* foo() {
   T* t;
   return func(&t); // currently, no error detected, despite returning pointer to t
 }

t should be declared T t. --NickTreleaven (talk) 11:38, 4 July 2016 (UTC)