13.07.2015 Views

Full Generic System V ABI

Full Generic System V ABI

Full Generic System V ABI

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Optional-data is not so interesting in itself, but it is very useful for describingrecursive data-structures such as linked-lists and trees. For example, the followingdefines a type ‘‘stringlist’’ that encodes lists of arbitrary length strings:s t r u c t * s t r i n g l i s t {s t r i n g i t e m < > ;s t r i n g l i s t n e x t ;} ;It could have been equivalently declared as the following union:u n i o n s t r i n g l i s t s w i t c h ( b o o l o p t e d ) {c a s e T R U E :s t r u c t {s t r i n g i t e m < > ;s t r i n g l i s t n e x t ;} e l e m e n t ;c a s e F A L S E :v o i d ;} ;or as a variable-length array:s t r u c t s t r i n g l i s t < 1 > {s t r i n g i t e m < > ;s t r i n g l i s t n e x t ;} ;Both of these declarations obscure the intention of the stringlist type, so theoptional-data declaration is preferred over both of them. The optional-data typealso has a close correlation to how recursive data structures are represented inhigh-level languages such as Pascal or C by use of pointers. In fact, the syntax isthe same as that of the C language for pointers.EFormats and Protocols for Networking 7-21

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!