QB64.org Forum
Active Forums => QB64 Discussion => Topic started by: badger on October 02, 2020, 04:23:39 pm
-
hello
anything z is integer64, anything l is long
zcustrecnum =lof(1) / lcustreclen
is this ok to do due to the different types
Badger
-
What is your target?
-
LONG is good for number of records, it will cover 10 million records at least :)
-
In QB64, you can use: DEFLNG L
So now any numeric variable that starts with "L" or "l" will be long. Funny though, by default any undefined numeric variable is already long. This makes me wonder why we haven't seen a _DEFINT64 new QB64 keyword yet, as back to your question, there is only DEFINT available in QB64, from the old QB45 days.
Assigning with TYPE is something I seldom do, but I would think you would have to type each variable, and not just the starting letter of any variable, but I might be mistaken.
Pete
-
Default is SINGLE not LONG
and
_DEFINE A-Z AS _INTEGER64 is how you'd do that.
-
Ask is, why you try to convert LONG to _INTEGER64 type?
-
hello
looks like i opened a can of worms LOL... to set an integer64 = to a number divide by a long just gives a warning just need to know if that is going to cause problems later.
here is my type defs
REM ***************************************************************************
_DEFINE I AS INTEGER : _DEFINE S AS STRING : _DEFINE D AS DOUBLE
_DEFINE F AS _FLOAT : _DEFINE L AS LONG : _DEFINE Z AS _INTEGER64
Badger
-
There will be no problems with data types if you use integers for integer types. I don't know what the two variables at the beginning of this thread are, zcustrecnum and lcustreclen. The difference between type LONG and _INTEGER64 is only in the maximum possible value and memory usage: LONG use 4 bytes in memory/file and _INTEGER64 use 8 bytes in memory/file . What are this two variables?
-
Hellp
@Petr
zcustrecnum and lcustreclen these two variables are record number and the length of my type def it has id number first name last name address city state zip phone number
Badger
-
QB64 implicitly adds casts when assigning values to a different numeric type so everything Just Works.
Keep in mind if the division produces a fraction, it will be rounded to a whole number before being assigned.
-
Default is SINGLE not LONG
and
_DEFINE A-Z AS _INTEGER64 is how you'd do that.
It's crazy how I have that twisted in my head. I always SWAP those terms, but I know the default symbol is the exclamation point.
Now I have to go look up _DEFINE. I've never used it before. Thanks Mark!
Pete