[AccessD] Integer v. Long

James Button jamesbutton at blueyonder.co.uk
Mon Sep 5 12:23:17 CDT 2022


Also less likely to cause overflow type problems - as in the move from .xls
worksheets  to .xlsx included an increase in the number of rows  so that integer
would not allow all the data rows (as in transfer from access tables) to be
processed.

My approach - unless there is a good reason for limiting the structure of data
held, then don't,
And definitely avoid unneeded limitations on the ability of code to handle the
data the app is specified to be able to handle.

No point in introducing a need for the extra effort of a correction later.
(Unless you are a seller of software where you can, and will be charging extra
for the corrected version.)

Also current instances of windows are defaulting to 64 bit registers

JimB

-----Original Message-----
From: AccessD
<accessd-bounces+jamesbutton=blueyonder.co.uk at databaseadvisors.com> On Behalf Of
Arthur Fuller
Sent: Monday, September 5, 2022 2:39 PM
To: Access Developers discussion and problem solving
<accessd at databaseadvisors.com>
Subject: Re: [AccessD] Integer v. Long

Thanks, Stuart. That clears it up.

On Mon, Sep 5, 2022 at 5:21 AM Stuart McLachlan <stuart at lexacorp.com.pg>
wrote:

> Nope. It's a matter of efficiency.
>
> In a 32bit or 64bit operating system (Access and WIndows) the OS uses 32
> bit  registers to
> manipulate integral values. Every time you use a 16 bit integer, the OS
> has to handle the
> translation to from 32bit.
>
> Bottom line - Longs are more efficient, especially for things like large
> loops.
>
>
> On 5 Sep 2022 at 4:15, Arthur Fuller wrote:
>
> > Frequently I encounter code (most often in samples but sometimes also
> > in examples, and even in code made available for public consumption)
> > in which the developer declares numeric variables as Long rather than
> > as Integer. This practice strikes me as a lazy habit.
> >
> > Data Type Low Range High Range Storage Requirement (bytes)
> > Integer -32,768 32,767 2
> > Long -2,147,483,648 2,147,483,647 4
> >
> > Granted, if storage and performance were critical, one would probably
> > not code in VBA. But for most practical purposes in VBA, it seems to
> > me that Longs are overkill.
> >
> > Opinions?
> > --
> > Arthur
> > --
> > AccessD mailing list
> > AccessD at databaseadvisors.com
> > https://databaseadvisors.com/mailman/listinfo/accessd
> > Website: http://www.databaseadvisors.com
> >
>
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> https://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>


-- 
Arthur
-- 
AccessD mailing list
AccessD at databaseadvisors.com
https://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list