Data Type Suffixes

[Previous] [Next]

One of the earliest methods of distinguishing data types was the use of Basic's data type suffixes. A data type suffix is a symbol representing a specific data type. You append these symbols to the ends of variable names. For instance, the type suffix for the String data type is the dollar sign ($). Using suffixes, you can create variable names such as FirstName$ and Address$ . Type suffixes have a number of drawbacks. The most apparent is that the suffixes aren't always intuitive. Do you know (or can you determine) the corresponding data types for these suffixes: %, &, !, and #? They are Integer, Long, Single, and Double, respectively. The difficulty of remembering type suffixes might not be enough reason to reject the convention. However, consider these variables :

  • Send (Long) ”represents a count of the number of messages sent
  • Send (Handle) ”a handle to the Comm (Communications) interface

Handles are actually Long integers. Reducing both of these variables to Send& doesn't help you to distinguish between the two.



Practical Standards for Microsoft Visual Basic
Practical Standards for Microsoft Visual Basic .NET (Pro-Developer)
ISBN: 0735613567
EAN: 2147483647
Year: 2000
Pages: 57

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net