Data Type Declaration

  • Thread starter Thread starter R Tanner
  • Start date Start date
R

R Tanner

Hi,

Do you choose the data type you will declare at the beginning of a
macro based on what range you know your values will be between?
 
I generally declare my data types based on how I expect the code to execute
and to get the results I need.
 
I use the most strict datatype that the values could possibly be for the
life of the program. My approach is realist-pessimist. What do the project
requirements need, but also what is the most far reaching possibility that
can occur as the client/project/data grows? It works quite well for me.
Overly-optimistic rules are the kiss of death of a program's functionality,
dooming a solution to a lifetime of support, IMO. (E.g. "We'll never have
more than 10,000 rows of data, so just use a short Int").
 
For numbers???

I use "As Long", never "As Integer".
I use "As Double", never "As Single".

No matter how small/large they may be.
 
How about As Byte?
I understand there is no point in using Integer instead of
Long as Long is faster (but maybe not measurable) than Integer plus
there is less chance of an overflow error.

RBS
 
Just so we are all on the same page... 16bit variables such as integers lose
their benefits since the systems all 32bit. There is actually extra overhead
to deal with an integer over a long... so long is more efficient.
 
I don't recall ever using "As Byte" either.

RB said:
How about As Byte?
I understand there is no point in using Integer instead of
Long as Long is faster (but maybe not measurable) than Integer plus
there is less chance of an overflow error.

RBS
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top