Errors, bugs, questions - page 2680
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
It's all right here too.
not correct!
I specifically checked it in VS2019:
Error CS0133 Expression assigned to "a" must be constant. ConsoleApp2 ..\repos\ConsoleApp2\ConsoleApp2\Program.cs 13 Active
Error CS0133 Expression assigned to "b" must be constant. ConsoleApp2 ..\repos\ConsoleApp2\ConsoleApp2\Program.cs 13 Active
this is not how it worked last year - I specifically tested const modifiers
and it seems that@Ilyas explained how to run an MQL-program, first all const and static are initialized, no matter where they are defined, and then the class constructors are called
ok, with this initialization static / const - it can still be properly distributed, but the fact that the const modifier does not guarantee that the compiler will check it - very unexpected - my second example
In both your examples everything works correctly and is expected.
In both your examples everything works correctly and is expected.
expectedly, const modifier is 99% sure that compiler will find my error when compiling, VS2019 does it, MQL does not do it
expected const modifier is 99% sure that compiler will find my error when compiling, VS2019 does it, MQL does not do it
What exactly do you consider an error?
I don't get any errors from VS2019.
last year it didn't work that way - I specifically tested const modifiers
and it seems that@Ilyas explained how to run MQL-program, first all const and static variables are initialized, no matter where they are described, and then the class constructors are called.
It seems to be global variables with const/static modifiers and you are using local variables.
What exactly do you consider an error?
I don't get any errors from VS2019.
the error is that the MQL compiler allows ambiguous expressions, if there is a const modifier, then it is a constant
this same code was nottracked by the compiler? the other situation has been tracked.
Sharp in VS2019 underlined everything before compilation.
You must have meant global variables with const/static modifiers, while you use local ones.
I may be confused, but const modifier behavior is very different from C#
A variable declared with a const modifier cannot be changed. The compiler keeps track of this.
You probably expect it to do something else.
You probably expect something different from it.
Apparently yes, I expect it to be the same when jumping between MQL and C#.
Build 2366
Thanks for the post, I will check
mq5 - normal. mq4 - broken. You can take TypeToBytes_ExampleScript.mq4 from here. It only compiles if you change the extension to mq5.