Tag (programming)
In programming, a tag is an argument to a subroutine that determines other arguments passed to it, which is used as a way to pass indefinite number of tagged parameters to the subroutine; notably, tags are used for a number of system calls in AmigaOS v2.0 and onwards. In AmigaOSIn earlier versions of AmigaOS, if a system call required setting a large number of parameters, instead of passing them as function arguments, the function would require a pointer to a structure that holds the arguments (for example, intuition.library's A number of third-party software libraries for AmigaOS also use tags extensively. Example
The code without tags is obscure (for example, ImplementationAmigaOS provides functions for tag handling in its In generalAn advantage of tags is that they ease the work with default arguments since the programmer doesn't have to specify them or their substitutes. From this follows another advantage, ease of achieving of both forward and backward compatibility with external libraries: a program written for an older version of the library will work with a newer one, since the newer library will simply set all the parameters not provided by the program to their default values; and a program written for a newer version of the library will still work with the older version, since the older library will simply pay no attention to the newly introduced tags. A disadvantage of tags is that their processing is slower than simply reading data from a structure or the stack. Additionally, compile time type checking is lost. See alsoReferences
External links |
Portal di Ensiklopedia Dunia