[fpc-devel] [Suggestion] Enumeration range-check intrinsic

J. Gareth Moreton gareth at moreton-family.com
Tue Jul 9 08:20:17 CEST 2019


Apologies - I see now... I used them with "with" without even thinking 
about it!  I've made the changes as requested. Admittedly it's quite 
hard for me to remove spaces from either side of operators because 
that's something I learnt from my early days in Turbo Pascal and to not 
have spaces (and all types and variables being lowercase) feels very 
C-like.  But hey, rules are rules... or guidelines!

Is the new AS-IS-enum-08 patch any better?

Gareth aka. Kit


On 09/07/2019 07:03, J. Gareth Moreton wrote:
> I don't recall using "as" or "is" directly, but if I've done so, I 
> humbly apologise and will fix that right away.
>
> Gareth aka. Kit
>
>
> On 09/07/2019 06:41, Sven Barth via fpc-devel wrote:
>> Am 08.07.2019 um 02:52 schrieb J. Gareth Moreton:
>>> On an extra note, the assembly language produced is not yet optimal, 
>>> so it may end up that an x86-specific implementation will be 
>>> beneficial.  TIsNode contains a virtual method named 
>>> "DoVariableEnumCheck" that would allow such an extension, coupled 
>>> with returning "nil" that would defer code generation to 
>>> "pass_generate_code" (allowing this, but not overriding 
>>> "pass_generate_code", will trigger an internal error, because the 
>>> 'is' node normally never allows it to be called).  Nevertheless, 
>>> even if that is a no-go, it's making me a little excited to see if I 
>>> can find new peephole optimisations to implement.  But until my old 
>>> x86_64 overhaul is accepted, rejected or reworked (at least to make 
>>> it successfully merge), I can't really make any new additions yet.
>> Some non-technical remarks regarding code formatting (I know the 
>> compiler does currently not use a consistent style, but there is one 
>> that is considered the de facto one (I should find the time to write 
>> that down in the Wiki some time -.-) and new code should be added 
>> following this):
>> - no spaces between operators and symbols, both in assignments and 
>> expressions as well as parameter declarations
>> - local variables are written in lower case with the declarations as 
>> "name1,name2,name3 : type"
>> - types are written in lower case
>> - method names are lower case with '_' as separator between words (so 
>> your DoVariableEnumCheck would become do_variable_enum_check)
>>
>> And one very important technical remark:
>> *No* "as" (or "is") inside the compiler. Use hard casts as you 
>> already checked for the def type
>>
>> Regards,
>> Sven
>> _______________________________________________
>> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
>> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
>>
>>
>
> ---
> This email has been checked for viruses by Avast antivirus software.
> https://www.avast.com/antivirus
>
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
>
>


More information about the fpc-devel mailing list