preparing for const, final, and invariant

Manfred Nowak svv1999 at hotmail.com
Fri May 18 12:16:17 PDT 2007


Walter Bright wrote

> Passing things through void* is a way of escaping the type
> checking, and if you break the rules by doing so, your program
> might break. 

The compiler seems to follow the specs which say

| A pointer T* can be implicitly converted to one of the following:
|
|    void*

There is no hint in the specs that this even _implicite_ possible 
conversion is breaking the security of the type system.

But let me assume for now, that this implicite conversion is an 
exception and that "breaks type system" will be included in the 
specs.

Now how about using a circular list, i.e avoiding use of `void *'

struct T{
  T* next;
}
T a;
void main(){
  T g;
  g.next= &g;
  void f( in T p){
    a= *(p.next); // @*_
  }
  f( g); // breaking of scope rule?
}

-manfred



More information about the Digitalmars-d-announce mailing list