[fpc-devel] Tests in Delphi XE3 regarding Type Helpers

Sven Barth pascaldragon at googlemail.com
Thu Nov 29 10:18:24 CET 2012


Am 29.11.2012 10:07, schrieb Marco van de Voort:
> In our previous episode, Sven Barth said:
>> Could someone with access to Delphi XE3 please compile and run the
>> attached tests and provide me with the output of the test or (in case of
>> an error) with the output of the compiler?
>> The tthlperrX.pas tests should not compile, so here I'd like to get the
>> error messages.
>> The other tests should compile, so please try to adjust them until they
>> do and report me any adjustments you made. If you can't get them to
>> compile then please report me the errors you get with the initial test file.
> D:\testing\rechelp>dcc32 tthlperr1.pas
> Embarcadero Delphi for Win32 compiler version 24.0
> Copyright (c) 1983,2012 Embarcadero Technologies, Inc.
> tthlperr1.pas(4) Error: E2018 Record, object or class type required
> tthlperr1.pas(6)
>
> D:\testing\rechelp>dcc32 tthlperr2.pas
> Embarcadero Delphi for Win32 compiler version 24.0
> Copyright (c) 1983,2012 Embarcadero Technologies, Inc.
> tthlperr2.pas(14) Error: E2018 Record, object or class type required
> tthlperr2.pas(15) Error: E2018 Record, object or class type required
> tthlperr2.pas(17)
Ok, the error for tthlperr1.pas was expected (though I was curious what 
the error message would be).
For tthlperr2.pas it would have been interesting to see if the same 
error is reported if a helper is in scope, but the method is invalid... 
could you please repeat that test with a string helper and a string 
constant? Or change the type of the int helper to "uint8" which seems to 
have helped in the tthlpsize.pas test...

> D:\testing\rechelp>dcc32 tthlpminus.pas
> Embarcadero Delphi for Win32 compiler version 24.0
> Copyright (c) 1983,2012 Embarcadero Technologies, Inc.
> tthlpminus.pas(14) Error: E2018 Record, object or class type required
> tthlpminus.pas(15) Error: E2018 Record, object or class type required
> tthlpminus.pas(17)
>
> 1. Typecasting the "42" literals to integer works
> 2. changing record helper type to "int64" doesn't.
> 3. Changing to smaller types (int8,int16) doesn't help.
> 4. changing to uint8 works for the "42" one, not for the "-42" one.
Ok... so Delphi does use the minimum required size for the constant. 
Good. Does "int8" help for the "-42"? What if you change it to 
"(-42).DoTest"?
> D:\testing\rechelp>dcc32 tthlpself.pas
> Embarcadero Delphi for Win32 compiler version 24.0
> Copyright (c) 1983,2012 Embarcadero Technologies, Inc.
> tthlpself.pas(36)
> 37 lines, 0.09 seconds, 18816 bytes code, 13240 bytes data.
>
> D:\testing\rechelp>tthlpself
> -> throws RTE 105

It seems that I forgot a "{$apptype console}" :)
>
> D:\testing\rechelp>dcc32 tthlpsize.pas
> Embarcadero Delphi for Win32 compiler version 24.0
> Copyright (c) 1983,2012 Embarcadero Technologies, Inc.
> tthlpsize.pas(24) Error: E2003 Undeclared identifier: 'Short'
> tthlpsize.pas(78) Error: E2015 Operator not applicable to this operand type
> tthlpsize.pas(80) Error: E2015 Operator not applicable to this operand type
> tthlpsize.pas(82) Error: E2015 Operator not applicable to this operand type
> tthlpsize.pas(84) Error: E2015 Operator not applicable to this operand type
> tthlpsize.pas(87)
>
> The first is easily fixable by changing short (which probably should have
> been shortint) to int16.
The introduction of the (U)IntXX types was one of the best things I 
remember (and luckily we already have them in FPC as well :) ), as I 
always forget how the smaller types are named... -.-

> The remaining errors are the negative values. I didn't find a solution for
> them with tthlpminus
So the hexadecimal values work correctly? What if you here also try the 
suggestion "(negativevalue).DoTest"? You might also want to add a 
"{$apptype console}" here.

Otherwise: Thank you so far. :)

Regards,
Sven



More information about the fpc-devel mailing list