Confusing? or just me. DEFINT

Forum for discussion about the documentation project.
Post Reply
Flyzone
Posts: 109
Joined: Nov 17, 2017 17:39

Confusing? or just me. DEFINT

Post by Flyzone »

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?
caseih
Posts: 2157
Joined: Feb 26, 2007 5:32

Re: Confusing? or just me. DEFINT

Post by caseih »

Maybe your font isn't quite right. It's the letter "i"

Maybe a better example would have been:

Code: Select all

defint m
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.
Flyzone
Posts: 109
Joined: Nov 17, 2017 17:39

Re: Confusing? or just me. DEFINT

Post by Flyzone »

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.
caseih
Posts: 2157
Joined: Feb 26, 2007 5:32

Re: Confusing? or just me. DEFINT

Post by caseih »

Ahh. Probably was an L before.
Last edited by caseih on Dec 11, 2022 17:32, edited 1 time in total.
caseih
Posts: 2157
Joined: Feb 26, 2007 5:32

Re: Confusing? or just me. DEFINT

Post by caseih »

Flyzone wrote: Dec 11, 2022 4:26It still doesn't tell you about prefixing with numbers.
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
Flyzone
Posts: 109
Joined: Nov 17, 2017 17:39

Re: Confusing? or just me. DEFINT

Post by Flyzone »

Forget that.

Was just thinking the underscore is left out.
https://www.freebasic.net/wiki/ProPgIdentifierRules
fxm
Moderator
Posts: 12081
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Confusing? or just me. DEFINT

Post by fxm »

The DEFINT documentation page has not been changed since 2016 (see '[History]').
(there is indeed a dot on the 'i')
caseih
Posts: 2157
Joined: Feb 26, 2007 5:32

Re: Confusing? or just me. DEFINT

Post by caseih »

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.
caseih
Posts: 2157
Joined: Feb 26, 2007 5:32

Re: Confusing? or just me. DEFINT

Post by caseih »

Flyzone wrote: Dec 11, 2022 4:26 That doc was CHANGED in between the time of our posts.
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.
Flyzone
Posts: 109
Joined: Nov 17, 2017 17:39

Re: Confusing? or just me. DEFINT

Post by Flyzone »

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
fxm
Moderator
Posts: 12081
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Confusing? or just me. DEFINT

Post by fxm »

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]
Post Reply