MqlDateTime dtS={0};
Hi! Thanks for the reply!
Well, that would explain the problem partially. My question is: in that case, why the compiler doesn't complain about the previous structure, currDTS, since it's also initialized whitin the same function?
Hi! Thanks for the reply!
Well, that would explain the problem partially. My question is: in that case, why the compiler doesn't complain about the previous structure, currDTS, since it's also initialized whitin the same function?
Checked your code (5430 and 5488) and I didn't get any warning. Please post code that compiles when you report an issue.
Hi!
I'm sorry, I keep forgetting :D Code attached (happening in version 5430).
I transmitted it to MQ. Though, in my opinion, it's not really a bug, but rather something that could (maybe) be improved.
Additionally you should ALWAYS initialize your variables, not doing it is a bad practice.
I transmitted it to MQ. Though, in my opinion, it's not really a bug, but rather something that could (maybe) be improved.
Additionally you should ALWAYS initialize your variables, not doing it is a bad practice.
Thanks!
And thanks for the note. Normally I initialize them (with the compiler usually remembering to do it when I forget), but the MqlDateTime structure is usually filled later with TimeToStruct (as in the example on its own Help page); the difference this time was the use of an alternative function to do TimeToStruct's job.
Have a nice day!
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi!
Since one of the latest versions (I won't be able to remember which, but I'm talking about last 1 month or so), I started to get the error "possible use of unitialized variable" in a code where that doesn't make sense (AFAICS):
The code is as follows:
So the compiler is saying that dtS may be used uninitialized, but that can't be the case: inside the for loop, at least one call to TimeToStruct2100 is going to happen (since 0 will always be < 290) where the structure will receive data:
Am I missing something or is the compiler really getting a false positive? In any case, the problem is easy to fix:
But I suppose MetaQuotes should be informed of the issue in case there is actually a bug, so here I am. Any thoughts?