[fpc-devel] An extension of fpc language: the BASED construct

Ozz Nixon ozznixon at gmail.com
Tue Dec 26 14:50:35 CET 2017

I like the concept, I would like to ask that we do not support INTEGER as a
type, and be more specific by limiting to SHORTINT, SMALLINT, LONGINT,
INT64. That way code snippets are not confusing when you implement 16bit
INT logic on a 32bit INT environment. Because I do a lot of documentation
for n00bs in Pascal - the interchangeable INTEGER is probably one of
Borland's biggest mistakes with the grammar! I would love to see FPC make
the statement that the type INTEGER is 16bit only - deal with people
freaking out for a year or two, and move the language forward. Even the
INTEGER example here is assuming 16bit - which would be incorrect on 32bit
platforms in specific $MODE. (may have picked wrong wording, however, I
think everyone see's the point).

Other than that, if FPC adds this, I will add it to Modern Pascal, so at
least the two products are supporting "BASED".

On Tue, Dec 26, 2017 at 8:27 AM, Mark Morgan Lloyd <
markMLl.fpc-devel at telemetry.co.uk> wrote:

> On 26/12/17 12:45, Giuliano Colla wrote:
> /In short the BASED construct makes the C-style dereferencing operator
>> unnecessary, by moving dereferencing from code to declaration.
>> In fpc this translates into code looking like this, in this trivial
>> example:
>> var
>>    I: BYTE;
>>    I1: INTEGER;
>>    ItemPtr: Pointer;
>>    Item: BYTE BASED ItemPtr;
>>    IntegerItem: INTEGER BASED ItemPtr;
>> ....
>>    ItemPtr := @I;
>>    Item := $41;
>> ....
>>    ItemPtr := @I1;
>>    IntegerItem := -32767;
>> This code will load the BYTE value $41 into the variable I, and the
>> INTEGER value -32767 into the variable I1.
> What does gdb (and possibly other debuggers) make of this? Is it really
> appropriate to declare Item as a variable, when it's really more akin to a
> macro?
> --
> Mark Morgan Lloyd
> markMLl .AT. telemetry.co .DOT. uk
> [Opinions above are the author's, not those of his employers or colleagues]
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20171226/b18995e9/attachment.html>

More information about the fpc-devel mailing list