schema pointer compatibility

Jay Michael <[email protected]>
Newsgroups gmane.comp.compilers.gpc
Message-ID <[email protected]>
     Why isn't the address of an object of a schema type an acceptable
value for a pointer to the (undiscriminated) schema type?

type sptr_type = ^ string ;
type sptr_array_type( n : integer ) = array [ 1 .. n ] of sptr_type ;
type sptr_array_ptr_type = ^ sptr_array_type ;

const s1 = 's1' ;
const s2 = 's2' ;
const s3 = 's3' ;

const slist : sptr_array_type(3) = ( @s1, @s2, @s3 ) ;

var slist_ptr : sptr_array_ptr_type = @slist ;


t12.pas:23: error: assignment from incompatible pointer type


     I got the same error when I changed "slist" (the object of the
discriminated schema type) from a "const" to a "var".
     I got the same error when I tried using an assignment statement:

          var slp : sptr_array_ptr_type ;
          ...
          slp := @slist ;

     If a discriminated instance of a schema type isn't quite the
same type as the undiscriminated type, then when would I ever be
able to use the address of an object as a value for a pointer to
the undiscriminated type?  (without coercion, that is)

_______________________________________________
Gpc mailing list
[email protected]
https://www.g-n-u.de/mailman/listinfo/gpc
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.