RPC/XDR struct
は C struct
とほぼ同様に宣言されます。RPC/XDR struct
の宣言は次のようになります。
struct-definition: struct struct-ident "{" declaration-list "}"
declaration-list: declaration ";" declaration ";" declaration-list
次の左の部分は二次元の座標の XDR 構造体の例で、右の部分はそれを C 言語にコンパイルした構造体です。
struct coord { struct coord { int x; --> int x; int y; int y; }; }; typedef struct coord coord;
出力は、出力の末端部で追加された typedef
以外は入力と同じです。これによって、項目を宣言する時に、struct
coord のかわりに coord を使用することができます。