Confusing? or just me. DEFINT
Confusing? or just me. DEFINT
DEFINT has the following example.
Examples:
This will make lNumber a Long integer number since it starts with l.
Not clear, at least to me ... Is it an I or a 1?
What if it starts with a number?
Examples:
This will make lNumber a Long integer number since it starts with l.
Not clear, at least to me ... Is it an I or a 1?
What if it starts with a number?
Re: Confusing? or just me. DEFINT
Maybe your font isn't quite right. It's the letter "i"
Maybe a better example would have been:
any variable that starts with "m" defaults to the type INTEGER, for example "myvariable." But you could choose any letter or range in the DEFINT statement. I remember typing DEFINT A-Z in my QB programs so I didn't have to type % all the time.
Anyway this is to do with variable names so by definition they start with letters. Numbers start with a number, but you can provide a suffix if there is ambiguity in the number's type. But that's a different thing from what DEFINT does.
DEFINT and friends are not used in the standard FB dialect. They are only for QB and FBLite.
Maybe a better example would have been:
Code: Select all
defint m
Anyway this is to do with variable names so by definition they start with letters. Numbers start with a number, but you can provide a suffix if there is ambiguity in the number's type. But that's a different thing from what DEFINT does.
DEFINT and friends are not used in the standard FB dialect. They are only for QB and FBLite.
Re: Confusing? or just me. DEFINT
That doc was CHANGED in between the time of our posts. I copied that line right out of the doc and now it's different. It still doesn't tell you about prefixing with numbers. BTW, I code exclusively in fblite.
Last edited by Flyzone on Dec 11, 2022 4:31, edited 1 time in total.
Re: Confusing? or just me. DEFINT
Last edited by caseih on Dec 11, 2022 17:32, edited 1 time in total.
Re: Confusing? or just me. DEFINT
Sorry I don't understand what you mean there. What's a number prefix? What does it have to do with variable types which is what DEF statements are all about. Nothing to do with numbers that I can see.
Numbers can be forced to be a particular type with a suffix (called a literal suffix), but not a prefix. See the list of literal suffixes here: https://www.freebasic.net/wiki/TblVarTypes
Re: Confusing? or just me. DEFINT
Forget that.
Was just thinking the underscore is left out.
https://www.freebasic.net/wiki/ProPgIdentifierRules
Was just thinking the underscore is left out.
https://www.freebasic.net/wiki/ProPgIdentifierRules
Re: Confusing? or just me. DEFINT
The DEFINT documentation page has not been changed since 2016 (see '[History]').
(there is indeed a dot on the 'i')
(there is indeed a dot on the 'i')
Re: Confusing? or just me. DEFINT
For the record the DEFINT wikipage is quite clear. There shouldn't be any confusion as it is written. It explicitly says the parameters to DEFINT are letters.
Re: Confusing? or just me. DEFINT
I think you must have looked at the DEFLNG page first. It definitely has "l" (capital L) as the example letter. While the page still talks about "letter" I suspect a different example letter would have been a bit clearer.
Re: Confusing? or just me. DEFINT
Perhaps you are correct if the doc hasn't changed since 2016. As you say the DEFLNG seems to use different fonts or cases in the example (looks like a "1" in front of Number), that is confusing, at least to me, but I'll move on. Thanks to clarifiers.
https://www.freebasic.net/wiki/KeyPgDeflng
https://www.freebasic.net/wiki/KeyPgDeflng
Re: Confusing? or just me. DEFINT
Yes.
Font homogenization in example's description sentence:
- KeyPgDefubyte → fxm [font correction]
- KeyPgDefstr → fxm [font correction]
- KeyPgDefsng → fxm [font correction]
- KeyPgDeflongint → fxm [font correction]
- KeyPgDeflng → fxm [font correction]
- KeyPgDefdbl → fxm [font correction]
- KeyPgDefbyte → fxm [font correction]
Font homogenization in example's description sentence:
- KeyPgDefubyte → fxm [font correction]
- KeyPgDefstr → fxm [font correction]
- KeyPgDefsng → fxm [font correction]
- KeyPgDeflongint → fxm [font correction]
- KeyPgDeflng → fxm [font correction]
- KeyPgDefdbl → fxm [font correction]
- KeyPgDefbyte → fxm [font correction]