Re: [fpc-pascal] Range check error warning.

2020-03-24 Thread Sven Barth via fpc-pascal

Am 24.03.2020 um 01:08 schrieb fredvs via fpc-pascal:

Hello.

With fpc 3.3.1 there is this warning:

"Warning: (4110) Range check error while evaluating constants (-193 must be
between 0 and 255)"

Here the code pointed by the warning:

const
  foldhiddenbit = 7;
  foldhiddenmask = 1 shl foldhiddenbit;
  currentfoldhiddenbit = 6;
  currentfoldhiddenmask = 1 shl currentfoldhiddenbit;
  foldlevelmask = byte(not (foldhiddenmask or currentfoldhiddenmask));
>Here the warning

I dont understand how the compiler can find -193 as value for
foldlevelmask...


Splitting the last constant a bit more allows to find the culprit:

=== code begin ===
const
  const1 = foldhiddenmask or currentfoldhiddenmask;
  const2 = not const1;
  const3 = byte(not const2);

=== code begin ===

The compiler will now complain on const3 (and a check with SizeOf(...) 
reveils that const2 is not of Byte size). I'll have to investigate 
however why the "not" behaves as it does.


Regards,
Sven
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Range check error warning.

2020-03-24 Thread Sven Barth via fpc-pascal
 schrieb am Di., 24. März 2020, 18:37:

> On 3/24/20 12:40 PM, fredvs via fpc-pascal wrote:
> > Hello Alexander.
> >
> > I did:
> >
> > const
> > foldhiddenbit : byte = 7; // line 896
> > foldhiddenmask : byte = 1 shl foldhiddenbit; // line 897
> > currentfoldhiddenbit : byte = 6; // line 898
> > currentfoldhiddenmask : byte = 1 shl currentfoldhiddenbit; // line
> 899
> > foldlevelmask : byte = not (foldhiddenmask or
> currentfoldhiddenmask); //
> > line 900
> >
> > That gives that error messages:
> >
> > msedatalist.pas(897,47) Error: (3203) Illegal expression
> > msedatalist.pas(899,61) Error: (3203) Illegal expression
> > msedatalist.pas(900,72) Error: (3203) Illegal expression
> > msedatalist.pas(1126,1) Fatal: (10026) There were 3 errors compiling
> module,
> > stopping
>
>
> you should figure out why typed constants are not being allowed/used in
> your
> setup...
>

Typed constants can not be used to initialize constants.

Regards,
Sven

>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Range check error warning.

2020-03-24 Thread fredvs via fpc-pascal
Many thanks Gerhald.

Now I have to deeply study your code, I did not catch all at first glance.

Write you later.

Fre;D 



-
Many thanks ;-)
--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Range check error warning.

2020-03-24 Thread Gerhard Scholz

z := x AND y is a bitwise AND


(not (foldhiddenmask or currentfoldhiddenmask))

results in

dec: -193hex:  ff3f bin:       0011 

this AND hex: $ff (bin: 1 ) gives

bin:       0011 
AND
bin:        

bin:       0011 

the result now definitely fits in a byte

The operators NOT, AND, OR, XOR (applied to integers) should be mentioned 
somewhere in the documentation, maybe the explanation there is clearer



- Original Message - 
From: "fredvs via fpc-pascal" 

To: 
Cc: "fredvs" 
Sent: Tuesday, March 24, 2020 8:59 PM
Subject: Re: [fpc-pascal] Range check error warning.



what about



foldlevelmask = (not (foldhiddenmask or currentfoldhiddenmask)) and $ff ;


Ha, this one fpc 3.3.1 like it!

No more warning nor error.

May I ask you what "and $ff" does, is it the same as "abs()" or keep it 
the

negative value?

Many thanks.

Fre;D



-
Many thanks ;-)
--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal



___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Range check error warning.

2020-03-24 Thread fredvs via fpc-pascal
> what about

> foldlevelmask = (not (foldhiddenmask or currentfoldhiddenmask)) and $ff ;

Ha, this one fpc 3.3.1 like it!

No more warning nor error.

May I ask you what "and $ff" does, is it the same as "abs()" or keep it the
negative value?

Many thanks.

Fre;D 



-
Many thanks ;-)
--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Range check error warning.

2020-03-24 Thread Gerhard Scholz

what about

foldlevelmask = (not (foldhiddenmask or currentfoldhiddenmask)) and $ff ;

instead of the "  f...  := byte(...) " line

?

- Original Message - 
From: "fredvs via fpc-pascal" 

To: 
Cc: "fredvs" 
Sent: Tuesday, March 24, 2020 1:08 AM
Subject: [fpc-pascal] Range check error warning.



Hello.

With fpc 3.3.1 there is this warning:

"Warning: (4110) Range check error while evaluating constants (-193 must 
be

between 0 and 255)"

Here the code pointed by the warning:

const
foldhiddenbit = 7;
foldhiddenmask = 1 shl foldhiddenbit;
currentfoldhiddenbit = 6;
currentfoldhiddenmask = 1 shl currentfoldhiddenbit;
foldlevelmask = byte(not (foldhiddenmask or currentfoldhiddenmask));
>Here the warning

I dont understand how the compiler can find -193 as value for
foldlevelmask...

Fre;D







-
Many thanks ;-)
--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal



___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Range check error warning.

2020-03-24 Thread fredvs via fpc-pascal
> perhaps calculate those results by hand and assign them.. then fix it
later? hehe

Yes, that is the thing with the gurus, it must seem complicated.

I agree that writing this:

> foldlevelmask = byte(not (foldhiddenmask or currentfoldhiddenmask)); 

is much more impressive than writing this:

> foldlevelmask = -193

;-)






-
Many thanks ;-)
--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Range check error warning.

2020-03-24 Thread Alexander Grotewohl
perhaps calculate those results by hand and assign them.. then fix it later? 
hehe

--
Alexander Grotewohl
https://dcclost.com


From: fpc-pascal  on behalf of fredvs 
via fpc-pascal 
Sent: Tuesday, March 24, 2020 1:53:19 PM
To: fpc-pascal@lists.freepascal.org 
Cc: fredvs 
Subject: Re: [fpc-pascal] Range check error warning.

> what mode are you compiling with?

{$mode objfpc}{$h+}



-
Many thanks ;-)
--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Range check error warning.

2020-03-24 Thread fredvs via fpc-pascal
> what mode are you compiling with?

{$mode objfpc}{$h+}



-
Many thanks ;-)
--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Range check error warning.

2020-03-24 Thread wkitty42

On 3/24/20 12:40 PM, fredvs via fpc-pascal wrote:

Hello Alexander.

I did:

const
foldhiddenbit : byte = 7; // line 896
foldhiddenmask : byte = 1 shl foldhiddenbit; // line 897
currentfoldhiddenbit : byte = 6; // line 898
currentfoldhiddenmask : byte = 1 shl currentfoldhiddenbit; // line 899
foldlevelmask : byte = not (foldhiddenmask or currentfoldhiddenmask); //
line 900

That gives that error messages:

msedatalist.pas(897,47) Error: (3203) Illegal expression
msedatalist.pas(899,61) Error: (3203) Illegal expression
msedatalist.pas(900,72) Error: (3203) Illegal expression
msedatalist.pas(1126,1) Fatal: (10026) There were 3 errors compiling module,
stopping



you should figure out why typed constants are not being allowed/used in your 
setup...



https://wiki.freepascal.org/Constants#Scalar_constants
https://www.freepascal.org/docs-html/ref/refse10.html


also, what mode are you compiling with? that may be tripping this up if the 
current mode doesn't allow typed constants...



--
 NOTE: No off-list assistance is given without prior approval.
   *Please keep mailing list traffic on the list where it belongs!*
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Range check error warning.

2020-03-24 Thread Bart via fpc-pascal
On Tue, Mar 24, 2020 at 6:00 PM fredvs via fpc-pascal
 wrote:

> OK, I stop.

This works?

{$mode objfpc}
{$apptype console}

const
  foldhiddenbit = byte(7);
  foldhiddenmask = byte(1 shl foldhiddenbit);
  currentfoldhiddenbit = byte(6);
  currentfoldhiddenmask = byte(1 shl currentfoldhiddenbit);
  intermediate = word(byte(foldhiddenmask) or byte(currentfoldhiddenmask));
  intermediate2 = Word(not intermediate);
  foldlevelmask = byte(lo(intermediate2)); //byte(not
(byte(foldhiddenmask) or byte(currentfoldhiddenmask)));

begin
  writeln('intermediate=',intermediate);
  writeln('foldlevelmask=',foldlevelmask);
end.

Prints:
intermediate=192
foldlevelmask=63


-- 
Bart
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Range check error warning.

2020-03-24 Thread fredvs via fpc-pascal
This make the compiler happy:

foldlevelmask = byte(abs(not (foldhiddenmask or currentfoldhiddenmask)));

Not sure it is better to do abs() but so no more warning.

Let's fix with it?







-
Many thanks ;-)
--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Range check error warning.

2020-03-24 Thread fredvs via fpc-pascal
And doing this:

 foldhiddenbit = byte(7);
 foldhiddenmask = byte(1 shl foldhiddenbit);
 currentfoldhiddenbit = byte(6);
 currentfoldhiddenmask = byte(1 shl currentfoldhiddenbit);
 foldlevelmask = abs(byte(not (foldhiddenmask or currentfoldhiddenmask)));
// line 891

Gives also a warning:
msedatalist.pas(891,22) Warning: (4110) Range check error while evaluating
constants (-193 must be between 0 and 255)

OK, I stop.

Fre;D







-
Many thanks ;-)
--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Range check error warning.

2020-03-24 Thread fredvs via fpc-pascal
And only changing this:

> foldhiddenbit: byte = 7;

Gives also a error message on next line unchanged:

> foldhiddenmask = 1 shl foldhiddenbit; // raise a error on that line.

Error: (3203) Illegal expression

Fre;D



-
Many thanks ;-)
--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Range check error warning.

2020-03-24 Thread fredvs via fpc-pascal
Hello Alexander.

I did:

const
   foldhiddenbit : byte = 7; // line 896
   foldhiddenmask : byte = 1 shl foldhiddenbit; // line 897
   currentfoldhiddenbit : byte = 6; // line 898
   currentfoldhiddenmask : byte = 1 shl currentfoldhiddenbit; // line 899
   foldlevelmask : byte = not (foldhiddenmask or currentfoldhiddenmask); //
line 900

That gives that error messages:

msedatalist.pas(897,47) Error: (3203) Illegal expression
msedatalist.pas(899,61) Error: (3203) Illegal expression
msedatalist.pas(900,72) Error: (3203) Illegal expression
msedatalist.pas(1126,1) Fatal: (10026) There were 3 errors compiling module,
stopping

Fre;D



-
Many thanks ;-)
--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Range check error warning.

2020-03-24 Thread Alexander Grotewohl
just to be clear.. you did do foldhiddenbit: byte = 7, etc?

--
Alexander Grotewohl
https://dcclost.com


From: fpc-pascal  on behalf of fredvs 
via fpc-pascal 
Sent: Tuesday, March 24, 2020 12:22:10 PM
To: fpc-pascal@lists.freepascal.org 
Cc: fredvs 
Subject: Re: [fpc-pascal] Range check error warning.

Hello WKitty.

   foldhiddenmask : byte = 1 shl foldhiddenbit;
   currentfoldhiddenmask : byte = 1 shl currentfoldhiddenbit;
   foldlevelmask : byte = not (foldhiddenmask or currentfoldhiddenmask);

  =

  msedatalist.pas(897,47) Error: (3203) Illegal expression
  msedatalist.pas(899,61) Error: (3203) Illegal expression
  msedatalist.pas(900,72) Error: (3203) Illegal expression


Thanks for the links for calculation, indeed the result is -193.

I did play with abs(), for example:

foldlevelmask = abs(byte(not (foldhiddenmask or currentfoldhiddenmask)));

But strangely still that warning:
Warning: (4110) Range check error while evaluating constants (-193 must be
between 0 and 255)

Fre;D


Fre;D





-
Many thanks ;-)
--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Range check error warning.

2020-03-24 Thread fredvs via fpc-pascal
Hello WKitty.

   foldhiddenmask : byte = 1 shl foldhiddenbit;
   currentfoldhiddenmask : byte = 1 shl currentfoldhiddenbit;
   foldlevelmask : byte = not (foldhiddenmask or currentfoldhiddenmask);

  =

  msedatalist.pas(897,47) Error: (3203) Illegal expression
  msedatalist.pas(899,61) Error: (3203) Illegal expression
  msedatalist.pas(900,72) Error: (3203) Illegal expression


Thanks for the links for calculation, indeed the result is -193.

I did play with abs(), for example:

foldlevelmask = abs(byte(not (foldhiddenmask or currentfoldhiddenmask)));

But strangely still that warning:
Warning: (4110) Range check error while evaluating constants (-193 must be
between 0 and 255)

Fre;D


Fre;D 

  



-
Many thanks ;-)
--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Range check error warning.

2020-03-24 Thread Alexander Grotewohl
Yes, those constants are defaulting to integer, which can represent both 
negative and positive values. When you do your shl you're inadvertently causing 
them to go into the range that pascal thinks is negative.

The typed constant should fix it.

--
Alexander Grotewohl
https://dcclost.com

From: fpc-pascal  on behalf of 
wkitt...@windstream.net 
Sent: Tuesday, March 24, 2020 11:49:33 AM
To: fpc-pascal@lists.freepascal.org 
Subject: Re: [fpc-pascal] Range check error warning.

On 3/23/20 8:08 PM, fredvs via fpc-pascal wrote:
> const
>   foldhiddenbit = 7;
>   foldhiddenmask = 1 shl foldhiddenbit;
>   currentfoldhiddenbit = 6;
>   currentfoldhiddenmask = 1 shl currentfoldhiddenbit;
>   foldlevelmask = byte(not (foldhiddenmask or currentfoldhiddenmask));
> >Here the warning
>
> I dont understand how the compiler can find -193 as value for
> foldlevelmask...


so let's work through it manually... with a little rambling because too much
c0ffee...


foldhiddenmask is1000 binary (128 decimal; 80 hex)
currentfoldhiddenmask is 0100 binary (64 decimal; 40 hex)

ORing them gives 1100 binary (192 decimal; c0 hex)
applying the NOT gives 0011 binary (63 decimal; 3f hex)

so that seems to come out as expected but i found several online bitwise
calculators that came with the same -193 answer that fpc returned... this seems
to be related to a wrong field initialization of some kind or using the wrong
size for the value...

go here: http://easyonlineconverter.com/converters/bitwise-calculator.html
place 1100 in field 1
leave field 2 blank
select "NOT"
click calculate


this one, https://toolslick.com/math/bitwise/not-calculator , gives the same
-193 result but you can also see that it is using 16 bits (word) instead of 8
bits (byte) so the top 8 zero bits are also NOTted which makes them ones and
there's the error... 0011 == -193... so i tried to trick it and used
16bits... damned thing prepended 8 more ones to the beginning... they're not
respecting that this is a byte we're working with...

i almost feel like telling both of them and the others i found that their
calculators are broken pretty badly... so back to your immediate problem...


apparently your byte() is not working as desired?

perhaps byte() is in the wrong place? perhaps it should be
   foldlevelmask = not (byte(foldhiddenmask) or byte(currentfoldhiddenmask));

perhaps the top 8 bits need to be cleared by forcing them to zeros somehow if
the default size of a const is larger than a byte?

perhaps it should be specified that all four of foldhiddenbit, foldhiddenmask,
currentfoldhiddenbit, currentfoldhiddenmask are of byte instead of word or 
other?


const
   foldhiddenbit : byte = 7;
   foldhiddenmask : byte = 1 shl foldhiddenbit;
   currentfoldhiddenbit : byte = 6;
   currentfoldhiddenmask : byte = 1 shl currentfoldhiddenbit;
   foldlevelmask : byte = not (foldhiddenmask or currentfoldhiddenmask);
*or*
   foldlevelmask : byte = not (byte(foldhiddenmask) or 
byte(currentfoldhiddenmask));



NOTE: i do not currently have FPC (or lazarus) installed so i haven't tested
this in fpc... i needed some drive space a few weeks back and it was easiest to
remove fpc and lazarus at the time... especially since i had four or five
versions of each installed with full source code...


--
  NOTE: No off-list assistance is given without prior approval.
*Please keep mailing list traffic on the list where it belongs!*
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Range check error warning.

2020-03-24 Thread wkitty42

On 3/23/20 8:08 PM, fredvs via fpc-pascal wrote:

const
  foldhiddenbit = 7;
  foldhiddenmask = 1 shl foldhiddenbit;
  currentfoldhiddenbit = 6;
  currentfoldhiddenmask = 1 shl currentfoldhiddenbit;
  foldlevelmask = byte(not (foldhiddenmask or currentfoldhiddenmask));
>Here the warning

I dont understand how the compiler can find -193 as value for
foldlevelmask...



so let's work through it manually... with a little rambling because too much 
c0ffee...



foldhiddenmask is1000 binary (128 decimal; 80 hex)
currentfoldhiddenmask is 0100 binary (64 decimal; 40 hex)

ORing them gives 1100 binary (192 decimal; c0 hex)
applying the NOT gives 0011 binary (63 decimal; 3f hex)

so that seems to come out as expected but i found several online bitwise 
calculators that came with the same -193 answer that fpc returned... this seems 
to be related to a wrong field initialization of some kind or using the wrong 
size for the value...


go here: http://easyonlineconverter.com/converters/bitwise-calculator.html
place 1100 in field 1
leave field 2 blank
select "NOT"
click calculate


this one, https://toolslick.com/math/bitwise/not-calculator , gives the same 
-193 result but you can also see that it is using 16 bits (word) instead of 8 
bits (byte) so the top 8 zero bits are also NOTted which makes them ones and 
there's the error... 0011 == -193... so i tried to trick it and used 
16bits... damned thing prepended 8 more ones to the beginning... they're not 
respecting that this is a byte we're working with...


i almost feel like telling both of them and the others i found that their 
calculators are broken pretty badly... so back to your immediate problem...



apparently your byte() is not working as desired?

perhaps byte() is in the wrong place? perhaps it should be
  foldlevelmask = not (byte(foldhiddenmask) or byte(currentfoldhiddenmask));

perhaps the top 8 bits need to be cleared by forcing them to zeros somehow if 
the default size of a const is larger than a byte?


perhaps it should be specified that all four of foldhiddenbit, foldhiddenmask, 
currentfoldhiddenbit, currentfoldhiddenmask are of byte instead of word or other?



const
  foldhiddenbit : byte = 7;
  foldhiddenmask : byte = 1 shl foldhiddenbit;
  currentfoldhiddenbit : byte = 6;
  currentfoldhiddenmask : byte = 1 shl currentfoldhiddenbit;
  foldlevelmask : byte = not (foldhiddenmask or currentfoldhiddenmask);
*or*
  foldlevelmask : byte = not (byte(foldhiddenmask) or 
byte(currentfoldhiddenmask));



NOTE: i do not currently have FPC (or lazarus) installed so i haven't tested 
this in fpc... i needed some drive space a few weeks back and it was easiest to 
remove fpc and lazarus at the time... especially since i had four or five 
versions of each installed with full source code...



--
 NOTE: No off-list assistance is given without prior approval.
   *Please keep mailing list traffic on the list where it belongs!*
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Disable Warning: (6060) Case statement does not handle all possible cases

2020-03-24 Thread fredvs via fpc-pascal
Hello.

According to:

 https://wiki.freepascal.org/Turn_warnings_and_hints_on_or_off

> Control specific warnings:

> Add

> {$warn  off}

> just after the unit name.


So doing this:

> unit myunit;   

>  {$warn 6060 off}

Still gives some  "Warning: (6060) Case statement does not handle all
possible cases"

How to disable it?

Thanks.





-
Many thanks ;-)
--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Chaining method calls

2020-03-24 Thread Ryan Joseph via fpc-pascal


> On Mar 24, 2020, at 8:39 PM, Michal Wallace via fpc-pascal 
>  wrote:
> 
> Hi Ryan,
> 
> It's possible. Just change your declaration of `c`:
> 
> var c: TBase;
> 
> It still prints TMyClass at the end.
> 
> Of course, you're only going to have access to methods that are declared in 
> TBase.
> You can also approach this sort of thing with interfaces... 
> 

True, but then we're stuck in a typecasting game where I need to cast "c" back 
to TMyClass. :) I probably brought this up years ago and forgot but Objective-C 
has an "id" type which is "can assign to any class type". It seems like 
something that would be standard for OOP but I don't recall ever seeing it in 
Pascal or C++.

Regards,
Ryan Joseph

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Chaining method calls

2020-03-24 Thread Michal Wallace via fpc-pascal
Hi Ryan,

It's possible. Just change your declaration of `c`:

var c: TBase;

It still prints TMyClass at the end.

Of course, you're only going to have access to methods that are declared in
TBase.
You can also approach this sort of thing with interfaces...

-Michal  ( http://tangentstorm.com/ )


On Tue, Mar 24, 2020 at 4:08 AM Ryan Joseph via fpc-pascal <
fpc-pascal@lists.freepascal.org> wrote:

> Free Pascal - General mailing list wrote
> > Is it possible to achieve this dynamically without resorting to type
> > casting? It feels like classes should have a builtin type for each class,
> > like TClassType, which similar to TObject.ClassType but is a compile time
> > type.
>
> I didn't think enough before sending this because this clearly isn't a
> compile time issue. Currently this probably isn't possible unless there is
> an "AnyClass" type or something like that. Not sure if that exists in
> Pascal
> but methinks not.
>
>
>
> -
> Regards,
> Ryan Joseph
> --
> Sent from: http://free-pascal-general.1045716.n5.nabble.com/
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Chaining method calls

2020-03-24 Thread Ryan Joseph via fpc-pascal
Free Pascal - General mailing list wrote
> Is it possible to achieve this dynamically without resorting to type
> casting? It feels like classes should have a builtin type for each class,
> like TClassType, which similar to TObject.ClassType but is a compile time
> type.

I didn't think enough before sending this because this clearly isn't a
compile time issue. Currently this probably isn't possible unless there is
an "AnyClass" type or something like that. Not sure if that exists in Pascal
but methinks not.



-
Regards, 
Ryan Joseph
--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal