[Ohrrpgce] SVN: teeemcee/9677 Remove all redundant byval's from allmodex. Also always capitalise Frame

Ralph Versteegen teeemcee at gmail.com
Tue Nov 7 08:40:09 PST 2017


I had wondered why you insisted on putting byval everywhere!

Yes, all scalar types (integers, enums and pointers) are byval, while
strings and UDTs are byref by default.
In -lang deprecated and -lang qb everything defaults to byref (though I had
to look that up; I hardly remember it). I do remember that we had to add
explicit byval and byref to everything in order to gradually switch to
-lang fb, since we needed to figure out which arguments needed to be
explicitly tagged byref for -lang fb. Since making the switch, the byvals
all became redundant.
But do be careful, there are a very few udts or strings intentionally
passed byval. That's another reason to not put byval and byref everywhere:
it's better to only write it in exceptional cases to draw attention to it.
Also, lately I have been writing "byref X as string" to indicated a UDT or
string argument that gets modified, and "X as string" to indicate one that
doesn't.

Also, I think "byval as string" used to be broken, but it works now.

But as another datapoint, "-w pedantic" makes fbc throw a warning if byval
or byref isn't given, and fbc itself uses that when compiling.

On 8 November 2017 at 04:44, James Paige <Bob at hamsterrepublic.com> wrote:

> Are integers byval by default?
>
> Maybe I am thinking of -lang deprecated where they were byref by default
>
> On Tue, Nov 7, 2017 at 7:38 AM, <subversion at hamsterrepublic.com> wrote:
>
>> teeemcee
>> 2017-11-07 07:38:16 -0800 (Tue, 07 Nov 2017)
>> 739
>> Remove all redundant byval's from allmodex. Also always capitalise Frame
>> and Palette16
>>
>> Which of the following is more readable?
>>   DECLARE SUB drawmap OVERLOAD (tmap as TileMap, byval x as integer,
>> byval y as integer, byval tilesetsprite as Frame ptr, byval p as integer,
>> byval trans as bool = NO, byval overheadmode as integer = 0, byval pmapptr
>> as TileMap ptr = NULL, byval ystart as integer = 0, byval yheight as
>> integer = -1, byval largetileset as bool = NO)
>> or
>>   DECLARE SUB drawmap OVERLOAD (tmap as TileMap, x as integer, y as
>> integer, tilesetsprite as Frame ptr, p as integer, trans as bool = NO,
>> overheadmode as integer = 0, pmapptr as TileMap ptr = NULL, ystart as
>> integer = 0, yheight as integer = -1, largetileset as bool = NO)
>> ---
>> U   wip/allmodex.bas
>> U   wip/allmodex.bi
>> _______________________________________________
>> Ohrrpgce mailing list
>> ohrrpgce at lists.motherhamster.org
>> http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org
>>
>
>
> _______________________________________________
> Ohrrpgce mailing list
> ohrrpgce at lists.motherhamster.org
> http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.motherhamster.org/pipermail/ohrrpgce-motherhamster.org/attachments/20171108/bc02ddf1/attachment.html>


More information about the Ohrrpgce mailing list