Here's an example of 2 error formats which changed across compiler version (I
think -vbr gives the gcc style output). The first format is the one I thought
was standard but the last time I updated trunk it changed to the second format
(line:column:). Was this a mistake or did I mess something up
Hello Sven.
OK, perfectly explained.
Many thanks for all that infos.
(It was needed to become Doctor es Enum).
And a trick from a Doctor es Enum:
"Always initialize by your self your enum before to use it".
Fre;D
-
Many thanks ;-)
--
Sent from: http://free-pascal-general.1045716.n5.na
Am 14.03.2020 um 17:18 schrieb fredvs via fpc-pascal:
Hi Sven, sorry to come back, (dont forget I am a enum-guru now).
But to be totally logic, in the previous code:
if kind = tabulatorkindty(0) then
Should it not be something illegal because of definition:
tabulatorkindty =
(tak_none := 1,
> as there are a lot of messages in this thread
Yes, it is an epidemic, and it has already muted there:
http://free-pascal-general.1045716.n5.nabble.com/Re-New-Warnings-with-fpc-gt-3-2-0-fredvs-td5735027.html
You will see with last message that all is not so simple:
Initialization of a enum-va
Apologies if already suggested as there are a lot of messages in this thread -
but would this meet your needs:
tabulatorkindty = (tak_none=-1,tak_left,tak_right,tak_centered,tak_decimal);
This ensures -1 is a valid enum value so tabulatorkindty(-1) should not raise a
warning (I’ve not tried it
Hi Sven, sorry to come back, (dont forget I am a enum-guru now).
But to be totally logic, in the previous code:
> if kind = tabulatorkindty(0) then
Should it not be something illegal because of definition:
> tabulatorkindty =
> (tak_none := 1,tak_left,tak_right,tak_centered,tak_decimal);
th
> much better to put it first in the list for numerous reasons...
Not sure it is much better but, yes, I will do it with the "better boy" way.
Thanks.
Fre;D
-
Many thanks ;-)
--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
___
> And it's not initialized with the first item, but with 0.
Well said, indeed, that example (see tak_none := 1):
PROGRAM enumtest;
type
tabulatorkindty =
(tak_none := 1,tak_left,tak_right,tak_centered,tak_decimal);
var
kind: tabulatorkindty;
begin
if kind = tak_none then
Writ
On 3/14/20 10:18 AM, fredvs via fpc-pascal wrote:
Yes, that is the main problem.
If you do it the "logical" way, placing at first without initialization,
when ord(kind) is used in code, because the order has changed, lot of code
must be re-written.
i don't see a problem with that... only some t
fredvs via fpc-pascal schrieb am Sa., 14.
März 2020, 13:01:
> So, thanks for the tip, "kind" seems indeed initialized with first item.
>
Please note that this is only true for global variables and fields of
classes. And it's not initialized with the first item, but with 0.
Regards,
Sven
>
>Note that if you depend on this technique you should add a comment where the
type is defined that the order of the items is
> significant so that someone in the future does not change the order out of
> ignorance!
Yes, that is the main problem.
If you do it the "logical" way, placing at first wit
Note that if you depend on this technique you should add a comment where the
type is defined that the order of the items is significant so that someone in
the future does not change the order out of ignorance!___
fpc-pascal maillist - fpc-pascal@lists
Hello BrunoK
>so a field in an object is by default initialized to tak_none during the
> object's creation.
Hum, doing this:
_
PROGRAM enumtest;
type
tabulatorkindty =
(tak_none,tak_left,tak_right,tak_centered,tak_decimal);
var
kind: tabulatorkindty;
begin
if k
A possibility, using your enumeration is to change it from
tabulatorkindty = (tak_left,tak_right,tak_centered,tak_decimal,
tak_none);
to
tabulatorkindty = (tak_none,tak_left,tak_right,tak_centered,tak_decimal);
so a field in an object is by default initialized to tak_none during the
object's
14 matches
Mail list logo