[Gambas-user] To wish list; optional compiler warning

Jussi Lahtinen jussi.lahtinen at ...626...
Fri Sep 9 19:11:03 CEST 2011


After I read what Fabien wrote, I realised what you meant and I think you
misunderstood my problem.

My problem is *not *that I have to write byref to function declaration and
to function call.
My problem is that if I forget to write byref to function call, I will get
silent bugs.

I think either byfer should be mandatory to write to function call, or there
should be warning from missing byref keyword.

Jussi



2011/9/8 Benoît Minisini <gambas at ...1...>

> > Hi!
> > Quick thought; it would be nice to have compiler warning if "byref" is
> > missing from function/sub call.
> > I know using byref is optional, but so far I have only forgot to add it.
> >
> > Example:
> >
> > Private Sub Test(Byref x As Integer)
> > ...
> >
> > And you can call it;
> > Test(i)
> > Or;
> > Test(Byref i)
> >
> >
> > Jussi
>
> By having to specify ByRef in the caller, you can't forget that the
> function
> will modify your variable (forgetting that leads to hard-to-fix bugs) and
> it
> help readers of your code.
>
> I added ByRef to Gambas only to help porting VB projects. In other cases,
> just
> don't use it, even if you find it more practical.
>
> Regards,
>
> --
> Benoît Minisini
>
>
> ------------------------------------------------------------------------------
> Doing More with Less: The Next Generation Virtual Desktop
> What are the key obstacles that have prevented many mid-market businesses
> from deploying virtual desktops?   How do next-generation virtual desktops
> provide companies an easier-to-deploy, easier-to-manage and more affordable
> virtual desktop model.http://www.accelacomm.com/jaw/sfnl/114/51426474/
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>



More information about the User mailing list