Hi Jerome,
can I use an enum value where an int was expected?
Having:
enum DataType { t1, t2 };
and a class
class Data { int type; }
I can not assign t1 to the type field of an instance of Data.
enum DataType : int { t1, t2 };
does not help.
PS
...did I ever said eC is great?
paolo
An enum in place of an int
Re: An enum in place of an int
Hi Paolo,
Enumerated values will not resolve unless you assign them to an int, they're only visible where their enumeration type is expected. That allows you to have the same enumerated values in different enums (e.g. 'none')
If you really want to assign it to an int, you can do:
type = DataType::t1;
or even:
type = (DataType)t1;
Yes you did Thanks!
How are your eC projects going? Anything interesting to talk about and share with our small community?
-Jerome
Enumerated values will not resolve unless you assign them to an int, they're only visible where their enumeration type is expected. That allows you to have the same enumerated values in different enums (e.g. 'none')
If you really want to assign it to an int, you can do:
type = DataType::t1;
or even:
type = (DataType)t1;
Yes you did Thanks!
How are your eC projects going? Anything interesting to talk about and share with our small community?
-Jerome
Re: An enum in place of an int
Hi Jerome,
thanks for the hints.
In a few days I'll start to publish my toy-project.
At now it is able to parse many constructs of an esotic AL (abstract language),
more or less eC (without parametric classes).
the parser is a hand-written discent parser. And it's still too incomplete to be able to measure
its speed with a large code base.
A small (and ridicoulously incomplete) VM is already able to perform this:
int c; for(c=0; c<1E6; c++);
in 60 msecs.
Not a record, but it sounds a miracle to me!
Today I started the second part (of three) of the game, the QL (query language).
It's a lisp-like syntax with which express matching and replacement rules to query
and transform the AST.
I'm quite happy of the work done till now (even if my code and design is still orrible).
Now I try to understand how to upload to github...
thanks for the hints.
In a few days I'll start to publish my toy-project.
At now it is able to parse many constructs of an esotic AL (abstract language),
more or less eC (without parametric classes).
the parser is a hand-written discent parser. And it's still too incomplete to be able to measure
its speed with a large code base.
A small (and ridicoulously incomplete) VM is already able to perform this:
int c; for(c=0; c<1E6; c++);
in 60 msecs.
Not a record, but it sounds a miracle to me!
Today I started the second part (of three) of the game, the QL (query language).
It's a lisp-like syntax with which express matching and replacement rules to query
and transform the AST.
I'm quite happy of the work done till now (even if my code and design is still orrible).
Now I try to understand how to upload to github...
Re: An enum in place of an int
Cool
Had you taken a look at my own attempt at a RD parser for eC?
https://github.com/ecere/ecere-sdk/tree ... ler/libec2
It is mostly working, just a few language features were missing. I just haven't had time to complete it and make it work together with everything else yet!
-Jerome
Had you taken a look at my own attempt at a RD parser for eC?
https://github.com/ecere/ecere-sdk/tree ... ler/libec2
It is mostly working, just a few language features were missing. I just haven't had time to complete it and make it work together with everything else yet!
-Jerome
Re: An enum in place of an int
Your code is always very clean,
so that everything seems so simple in eC...
I got some errors in ec2 / ASTList (some weeks ago I remember I tried to fix them,
maybe now I could be more happy).
so that everything seems so simple in eC...
I got some errors in ec2 / ASTList (some weeks ago I remember I tried to fix them,
maybe now I could be more happy).