Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: VB4,VB5,VB6
Expertise: Intermediate
Apr 20, 1999

Beware of Defxxx directives

Every now and then I see DefInt or DefLng directives spread over Visual Basic code modules, whose intended purpose is to revert the default data type from Variant to Integer or Long. I don't encourage using this directive, because it makes all the procedures in the module dependent of something that is placed outside them. In other words, you don't have self-sufficient and encapsulated procedures anymore.

You see the perverse effect of this when you move the procedure to another module or project that has a different Defxxx directive, or has no such directive at all. All of a sudden, your carefully tested procedures aren't working as they used to do, but you're the one to blame.

Francesco Balena
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date