Sizeof

Forum for discussion about the documentation project.
speedfixer
Posts: 216
Joined: Nov 28, 2012 1:27

Sizeof

Postby speedfixer » Oct 03, 2017 4:35

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: 328
Joined: May 05, 2015 5:35
Location: Germany

Re: Typeof

Postby grindstone » Oct 03, 2017 8:35

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: 216
Joined: Nov 28, 2012 1:27

Re: Typeof

Postby speedfixer » Oct 03, 2017 15:35

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: 216
Joined: Nov 28, 2012 1:27

Re: Sizeof

Postby speedfixer » Oct 03, 2017 15:57

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

Re: Sizeof

Postby grindstone » Oct 03, 2017 23:11

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

Re: Sizeof

Postby fxm » Oct 06, 2017 9:47

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: 216
Joined: Nov 28, 2012 1:27

Re: Sizeof

Postby speedfixer » Oct 10, 2017 20:39

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: 7108
Joined: May 28, 2005 3:28
Location: Germany

Re: Sizeof

Postby D.J.Peters » Oct 10, 2017 21:26

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
Posts: 7274
Joined: Apr 22, 2009 12:46
Location: Paris suburb, FRANCE

Re: Sizeof

Postby fxm » Oct 10, 2017 22:08

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

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

Re: Sizeof

Postby D.J.Peters » Oct 11, 2017 4:51

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
Posts: 7274
Joined: Apr 22, 2009 12:46
Location: Paris suburb, FRANCE

Re: Sizeof

Postby fxm » Oct 11, 2017 7:58

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

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

Return to “Documentation”

Who is online

Users browsing this forum: No registered users and 2 guests