CSIRO Mathematics, Informatics and Statistics
|
|
|
Next: LIAR C prototyping standard Up: LIAR coding Style Previous: Handling dimensionality
Handling variantsFunctions are usually written with a specific data type in mind. However, image data comes in a variety of types, such as char, int, float etc. Therefore, functions should be written to cope with different types. In the LIAR, functions cope with different data types by either: 1) being passed the data type in the argument list; or 2) there exists different versions of the same function specifically written to handle each data type expected. The latter approach is often the simplist. Figure 10 provides an example of how different versions of the same function can be declared. Note, these two functions are just copies of each other, with the appropriate data type changed. Also note, that the name of the function reflects the data type expected by the function.
Ed Breen Tue Sep 3 17:19:31 EST 1996 |