Re: Proper way of dimensioning variable
From: Jan Hyde (StellaDrinker_at_REMOVE.MEuboot.com)
Date: 07/09/04
- Next message: Jan Hyde: "Re: Loop is crashing app and dunno why"
- Previous message: Larry Serflaten: "Re: Filelist display"
- In reply to: Larry Serflaten: "Re: Proper way of dimensioning variable"
- Next in thread: Duane Bozarth: "Re: Proper way of dimensioning variable"
- Reply: Duane Bozarth: "Re: Proper way of dimensioning variable"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 09 Jul 2004 23:02:22 +0100
On Fri, 9 Jul 2004 15:59:16 -0500, "Larry Serflaten"
<serflaten@usinternet.com> wrote:
>
>"Jack" <replyto@newsgroup> wrote
>> I know it is trivial but suddenly I started wondering.
>> If I have numeric variable, which value will never exceed 255 is it better
>> to declare it as a Byte or should I use Long or Integer.
>> Which is a proper way? What is a good programming practice?
>
>I would suggest the proper way would be to use the Byte type,
>because it is the smallest type that will hold all the values you
>need. (Think for a moment why there are different types at all)
>
>But I have to agree with the other posts that suggest good practice
>would be to use the Long type, because it is the native type of the
>processor.
To add to the discussion I prefer to use the a data type which best
defines the data. I could use a long, but if an integer best describes
the range of possible values then I prefer to use an integer. It's a
self documenting style of coding which for me outweighs the advandage
of saving a few clock cycles
>In practise, all my variables are either Long or String unless there
>is a need otherwise. Groups of variables, either as UDT's or
>Arrays, or in a DB, are more inclinded to limit data sizes to
>conserve memory, but for individual variables, Long and String
>types cover a lot of ground....
Most of my apps database apps, guess this is why I prefer to use the
most appropriate data typr for the data, it helps validate the data
before you attempt to update the databse. The only exception is that I
always use strings for dates so I can easily represent a null value.
- Next message: Jan Hyde: "Re: Loop is crashing app and dunno why"
- Previous message: Larry Serflaten: "Re: Filelist display"
- In reply to: Larry Serflaten: "Re: Proper way of dimensioning variable"
- Next in thread: Duane Bozarth: "Re: Proper way of dimensioning variable"
- Reply: Duane Bozarth: "Re: Proper way of dimensioning variable"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|