is it valid to use 2 same argument in function declaration?

New to FreeBASIC? Post your questions here.
oyster
Posts: 203
Joined: Oct 11, 2005 10:46

is it valid to use 2 same argument in function declaration?

Postby oyster » Jan 16, 2019 13:58

in a code, I found many lines like

Code: Select all

declare function Fl_Tree_ItemFindChildByItem(byval item as Fl_Tree_Item ptr, byval item as Fl_Tree_Item ptr) as long

you may find that, the first and second arguments are both "item"

So, I realize that FreeBasic allows this
fxm
Posts: 9529
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: is it valid to use 2 same argument in function declaration?

Postby fxm » Jan 16, 2019 14:11

At the procedure declaration level (not in the body header of the procedure), parameter names are optional. Only type names (with passing conventions) and default values ​​(if any) are required.
So compiler does not check if there is parameter name duplication.

Code: Select all

declare function Fl_Tree_ItemFindChildByItem(byval as Fl_Tree_Item ptr, byval as Fl_Tree_Item ptr) as longtype
is sufficient.

Return to “Beginners”

Who is online

Users browsing this forum: No registered users and 1 guest