Sizeof

Forum for discussion about the documentation project.
Post Reply
speedfixer
Posts: 606
Joined: Nov 28, 2012 1:27
Location: CA, USA moving to WA, USA
Contact:

Sizeof

Post by speedfixer »

It would save some people a little time if it could be noted that this is an integer return.

The type makes a difference to some externals and header declarations.



Thank you.


David


correction: changed topic to 'sizeof'
Last edited by speedfixer on Oct 03, 2017 15:55, edited 1 time in total.
grindstone
Posts: 862
Joined: May 05, 2015 5:35
Location: Germany

Re: Typeof

Post by grindstone »

Code: Select all

Dim As String a
#Print TypeOf(a)
outputs a compiler message:

STRING

Correct me if I'm wrong, but that doesn't look like an integer value to me.
speedfixer
Posts: 606
Joined: Nov 28, 2012 1:27
Location: CA, USA moving to WA, USA
Contact:

Re: Typeof

Post by speedfixer »

Code: Select all

' size_of.bas

' test the return type of 'sizeof'

dim as byte bbb
dim as integer iii
dim as long lll

#print typeof(sizeof(iii))
#print typeof(sizeof(lll))

bbb = sizeof(iii)
print bbb

bbb = sizeof(lll)
print bbb

Later: corrected

Yes, I see, this proves type of 'sizeof'.
(Yours tells us the type of a string, a.)

My mistake: the keyword title should have been: sizeof.

Stiil - isn't in docs what the type is of the return of either keyword.

I will check some more.

David
speedfixer
Posts: 606
Joined: Nov 28, 2012 1:27
Location: CA, USA moving to WA, USA
Contact:

Re: Sizeof

Post by speedfixer »

Description and other notes at 'typeof' are fine - no change requested there.
grindstone
Posts: 862
Joined: May 05, 2015 5:35
Location: Germany

Re: Sizeof

Post by grindstone »

speedfixer wrote:My mistake: the keyword title should have been: sizeof.
Errare humanum est. ;-)
fxm
Moderator
Posts: 12098
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Sizeof

Post by fxm »

Exhaustive list of keywords where the return datatype is not specified precisely (one way or another) in the documentation:
- Sizeof
- Open
- Point
- __FB_DEBUG__
- __FB_ERR__
- __FB_MIN_VERSION__
- __FB_MT__
- __FB_OPTION_ESCAPE__
- __FB_OPTION_EXPLICIT__
- __Fb_Option_Gosub__
- __FB_OPTION_PRIVATE__
- __FB_OUT_DLL__
- __FB_OUT_EXE__
- __FB_OUT_LIB__
- __FB_OUT_OBJ__
- __FB_VER_MAJOR__
- __FB_VER_MINOR__
- __FB_VER_PATCH__

I hope I have not forgotten some others?
I think this is not of great interest for the pre-defined symbols (__ * __) ?

=>:
KeyPgOpen → fxm [Added the datatype of return value]
KeyPgSizeof → fxm [Added the datatype of return value]
KeyPgPoint → fxm [Added the datatype of return value]
speedfixer
Posts: 606
Joined: Nov 28, 2012 1:27
Location: CA, USA moving to WA, USA
Contact:

Re: Sizeof

Post by speedfixer »

Thank you.

I just saves some time and trouble when you need to know.
Example is interfacing directly with an external library.
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: Sizeof

Post by D.J.Peters »

fxm wrote:I hope I have not forgotten some others?
Hello fxm can you add the return type of KeyPgFreefile and make a link on the same page to the wikki page with the description how to get the real OS file HANDLE from FreeBASIC file number ?

Tank you

Joshy
fxm
Moderator
Posts: 12098
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Sizeof

Post by fxm »

- The first paragraph "Syntax" defines the return type (Long).

- What is the precise page to link?
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: Sizeof

Post by D.J.Peters »

fxm wrote:- The first paragraph "Syntax" defines the return type (Long).
declare function Freefile ( ) as long
How I could be so blind :-)
fxm wrote:- What is the precise page to link?
The problem I don't find it and was thinking you known the right page.

I mean if you need the real file HANDLE = C runtime FILE ptr (32/64-bit) from long (32-bit) FreeFIle() number.

How ever thank you.

Joshy
fxm
Moderator
Posts: 12098
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Sizeof

Post by fxm »

Yes, okay, I've done my memory work and I think the KeyPgFileattr page is the right (with a nice example of what you're looking for).

Documentation updated:
KeyPgFreefile → fxm [Added a link to FileAttr]
Post Reply