FreeBasic now listed at GTK+ website

For other topics related to the FreeBASIC project or its community.
TJF
Posts: 3601
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

FreeBasic now listed at GTK+ website

Postby TJF » Oct 25, 2010 9:23

The GTK+ support for FreeBasic is now listed on the official GTK+ website, at

http://www.gtk.org/language-bindings.html
Last edited by TJF on Nov 04, 2010 11:39, edited 1 time in total.
AGS
Posts: 1284
Joined: Sep 25, 2007 0:26
Location: the Netherlands

Re: FreeBasic at GTK+ website

Postby AGS » Oct 26, 2010 22:31

TJF wrote:The GTK+ support for FreeBasic is now listed on the official GTK+ website, at

http://www.gtk.org/language-bindings.html


Good job, TJF.

And now for a somewhat more negative message (sorry): when I include the header file I get a lot of warnings (compiling using -w pedantic) that there is no explicit byval or byref at parameter x.

Example
D:\freebasic211\inc\GTK_2_22_0_TJF.bi(4813) warning 16(0): No explicit BYREF or BYVAL, at parameter 2 of g_sequence_get_iter_at_pos()


When I don't use -w pedantic compilation takes no time whatsoever. When I do use pedantic I'm left looking at a seemingly endless stream of warning messages.

Could you somehow add an explicit byval to parameters?
TJF
Posts: 3601
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: FreeBasic at GTK+ website

Postby TJF » Oct 27, 2010 6:25

Thanks for feedback! (The first one I get about the function of my GTK headers.)

Interesting! I didn't try the -w pedantic option yet.

Yes, I may add BYVALs in the parameter lists. Since this means about 2 weeks of effort (implemention and testing), it may be an issue for the next release.

But I think we should discuss it first. Have a look at your example:
AGS wrote:...
Example
D:\freebasic211\inc\GTK_2_22_0_TJF.bi(4813) warning 16(0): No explicit BYREF or BYVAL, at parameter 2 of g_sequence_get_iter_at_pos()
...

Line 4813 is:
DECLARE FUNCTION g_sequence_get_iter_at_pos(AS GSequence PTR, AS gint) AS GSequenceIter PTR

There is a #LANG "fb" at the beginning of the header. From the fbc docs:
-lang fb (the default mode)
Not supported:
...
4) all parameters passed by reference by default

By default, all intrinsic scalar types - numeric and pointer types - are passed by value (ByVal). Any other type - String or user-defined type - is passed by reference (ByRef).

Use the -w pedantic command-line option to have parameters without explicit ByVal or ByRef reported.
...

We get 2 warnings on line 4813 regarding parameter 1 and 2.
    Parameter 1 is a PTR. It is an intrinsic scalar type. No warning should be given!
    Parameter 2 is an UDT, it may cause a warning. But gint is declared in line 495: TYPE AS INTEGER gint. So gint is INTEGER and this is also an intrinsic scalar type. Also this warning is superfluous.

From my point of view the warnings are to lesser extent a header issue. I rather think this is an fbc issue regarding the parameter passing in "fb" mode or at least the -w pedantic command line option.

Edit:
Anyway, none of the warnings will lead to a malfunction. Since there is no other feedback, the header seems to works perfect. I see no urgent need for changes at the moment.
Galeon
Posts: 563
Joined: Apr 08, 2009 5:30
Location: Philippines
Contact:

Postby Galeon » Oct 27, 2010 6:57

It is a good programming practice to add byval or byref. That's why it is in pedantic warnings. I also use it in all my projects.
TJF
Posts: 3601
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Postby TJF » Oct 27, 2010 9:56

Galeon wrote:It is a good programming practice to add byval or byref. That's why it is in pedantic warnings. I also use it in all my projects.

You're right! I also use BYVAL/BYREF in a sensible manner. In small projects it's included in every parameter list.

But keep in mind:
The GTK+ header is 1.8 Mb in size, including all the basic libs atk, glib, ... In this case, I try to save disk space and I try to make compiling as fast as possible. Working on a GTK project means compiling it 100 time a day and more. It saves an noteworthy amount of time when the header is as small as possible.

As a beginner, I didn't care about this issue. Since I code bigger projects, it gets more important.
Galeon
Posts: 563
Joined: Apr 08, 2009 5:30
Location: Philippines
Contact:

Postby Galeon » Oct 27, 2010 13:22

For others, they might not like it. Some are using pedantic (I use it often, FreeBASIC headers uses this) then those warnings will add up to theirs. And even if your header is quite large, the one included with FreeBASIC is also large (might be larger). Headers are texts so they are more compressible.
But I can't force you if you won't.
TJF
Posts: 3601
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Postby TJF » Oct 27, 2010 13:49

Galeon wrote:But I can't force you if you won't.

Using good arguments, you cannot force but you can convince me.

Galeon wrote:And even if your header is quite large, the one included with FreeBASIC is also large (might be larger). Headers are texts so they are more compressible.

It's not the disc space nor the internet data transfer, it's the compiling speed I had in mind when I
    1) put all headers in one file (separate headers are only useful for the GTK+ developers, coding in C), and
    2) use as few as possible words in the headers.

Galeon wrote:For others, they might not like it. Some are using pedantic (I use it often, FreeBASIC headers uses this) then those warnings will add up to theirs.

I didn't use this option yet. I will use it for final versions in the future.

But keep in mind:
    A) The headers are working fine (these are warnings, not errors), and
    B) the warnings are unnormal (or undocumented). The fbc compiler does not warn as described in the documentation on #LANG "fb".
Galeon
Posts: 563
Joined: Apr 08, 2009 5:30
Location: Philippines
Contact:

Postby Galeon » Oct 27, 2010 14:41

Just like what I said, I won't force you if you don't really want to :).
But you could also add an option for that, its for you to decide whether to enable it as default or not.
TJF
Posts: 3601
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Postby TJF » Oct 27, 2010 15:41

Galeon wrote:Just like what I said, I won't force you if you don't really want to :).

Just like what I wrote: good arguments will convince me.

Again:
This header is not a tutorial for beginners. GTK-2.22.0_TJF.bi is an advanced header, optimised for high speed compiling.
Galeon wrote:But you could also add an option for that, its for you to decide whether to enable it as default or not.

There is allready an option for the use of BYVAL in h_2_bi. It's easy to switch it on. But this has to be done before manual translation, improvements and tests on LINUX and win starts.

Since there is no error, no immediate action is required. I first like to read a statement from the fbc developers regarding the warnings, and - more important - the parameter passing in #LANG "fb". If the compiler wouldn't get improved, I'll add BYVAL in the next update as a workaround.
Galeon
Posts: 563
Joined: Apr 08, 2009 5:30
Location: Philippines
Contact:

Postby Galeon » Oct 27, 2010 16:44

From my point of view the warnings are to lesser extent a header issue. I rather think this is an fbc issue regarding the parameter passing in "fb" mode or at least the -w pedantic command line option.

I first like to read a statement from the fbc developers regarding the warnings, and - more important - the parameter passing in #LANG "fb".

Those warnings are only shown when pedantics is added in the options, so the contents of the wiki about "fb" mode is still correct. I think it is because they cannot force everyone to adhere to good programming practice, that's why its in pedantic.
Try using IRC, the FreeBASIC developers are almost always there.
TJF
Posts: 3601
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Postby TJF » Oct 27, 2010 17:16

Slow down, Galeon!

I'm sure, the developers will read it here and they'll give a well considered answer when they have made their minds.
Galeon
Posts: 563
Joined: Apr 08, 2009 5:30
Location: Philippines
Contact:

Postby Galeon » Oct 27, 2010 17:38

I asked in the IRC but there are no active devs, there are some online. I only asked if there are any who would like to have byval added by default in h2bi, all that responded said yes except one that didn't say yes or no...
I won't try to convince you starting today, I don't want to argue about others' work...
agamemnus
Posts: 1842
Joined: Jun 02, 2005 4:48

Postby agamemnus » Oct 27, 2010 17:45

Well, I think it goes back to the idea that strings might someday be allowed to be passed byval. Perhaps even UDTs, too. This is quite unlikely, but if it happens then your headers won't work correctly. The rest is just about (personal?) style.
TJF
Posts: 3601
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Postby TJF » Oct 28, 2010 6:49

At my bottom line:

1) -w pedantic warnings:
    First I thought the standard parameter passing in #LANG "fb" is BYVAL and the compiler will warn if the passing isn't standard. I red the docs again and I learned that I was wrong. It's documented that the compiler will warn for every parameter which has neither BYVAL nor BYREF.

    Conclusion: the compiler and the docs are OK, a developers statement is wellcome but isn't required. Sorry for that (, I'm not a native speaker).
2) GTK-2.22.0_TJF.bi
    I made a working header for the actual GTK version and I shared it as open source. This header is optimised for my personal needs. If anybody does not like my personal style, he or she is free to change it under the terms of LGPLv2.

    Conclusion: The header is working fine, no action is required. Today, I'm not sure if I'll use BYVAL in further version. (I'll do some tests to find it out.)
3) h_2_bi:
    The actual version of h_2_bi (0.1.9.2) can generate code with or without BYVAL. By default, BYVAL is used. It can be switched off using the option -P_oBV.

    Conclusion: nothing to be done.

Up in smoke :)
relsoft
Posts: 1767
Joined: May 27, 2005 10:34
Location: Philippines
Contact:

Postby relsoft » Oct 28, 2010 9:31

TJF wrote:
Galeon wrote:It is a good programming practice to add byval or byref. That's why it is in pedantic warnings. I also use it in all my projects.

You're right! I also use BYVAL/BYREF in a sensible manner. In small projects it's included in every parameter list.

But keep in mind:
The GTK+ header is 1.8 Mb in size, including all the basic libs atk, glib, ... In this case, I try to save disk space and I try to make compiling as fast as possible. Working on a GTK project means compiling it 100 time a day and more. It saves an noteworthy amount of time when the header is as small as possible.

As a beginner, I didn't care about this issue. Since I code bigger projects, it gets more important.


Anyone for "precompiled headers" support in FB?

Return to “Community Discussion”

Who is online

Users browsing this forum: No registered users and 3 guests