Next: , Previous: , Up: Structs   [Contents][Index]


10.5.12 Casting Structs

It is possible to cast a struct of some particular type into another struct type. Examples:

(poke) deftype Foo = struct { int i; int j; };
(poke) deftype Bar = struct { int k; int j; };
(poke) Bar {j=2} as Foo {}
Foo {i=0,j=2}

The semantics of the cast are exactly the same than constructing a struct of the target type using the struct provided as an expression to the cast.