This forum is in read-only mode now. You may discuss your questions on forums of MQL4.community and MQL5.community

Bug Report List: Build 140


Back to topics list
avatar
153
CoenWillemse 2004.12.15 03:12 
Hi,

I've been having some problems with assigning variables to arrays. If an attempt is made to compile the following:

1. double signal01 = 0.4;
2. double signal02 = 0.7;
3. double results[] = {0.4, 0.7}; // No Problems...
4.
5. double results01[] = {signal01, signal02}; // Errors! (See below)

I get the following errors on line 5:
'signal02' - variable is already defined
'}' - comma or semicolon expected

If I assign the variables to the array using the other method - i.e:
1. double signal01 = 0.4;
2. double signal02 = 0.7;
3. double results[] = {0.4, 0.7};
4.
5. double results01[2];
6. results01[0] = signal01;
7. results01[1] = signal02;

I don't have any problems. I'm presuming this is a bug but if I'm doing something wrong, I'd appreciate someone letting me know?


Cheers!

Coen Willemse

avatar
4464
Slawa 2004.12.15 11:11 
arrays, static and external variables can be initialized with constants only
avatar
153
CoenWillemse 2004.12.15 11:22 
Ah - that explains a lot! Thanx

Here's another one for you. If I use one of the following commands to get user input:

extern string stuff = "SDFSDFGSGFS";

or simply

extern string stuff;

and start the expert, the expert startup page (where you can fill in all the expert options) won't allow me to change the string. If I use any other types of "extern" type variable declarations, (e.g double, int etc), I can change the user options at will. Is this a bug or is it not possible to get user input in 'sting' format?
avatar
4464
Slawa 2004.12.15 12:36 
there is bug and we are fixing it now. wait for next build
avatar
153
CoenWillemse 2004.12.15 13:02 
Thanks!
avatar
153
CoenWillemse 2004.12.16 00:52 
Hi,

There still seems to be a problem with the 'extern string' side of things. It appears that if the string is initialized using either:

extern string stuff;
or extern string stuff = "";

the user input screen will allow you to input a string but 'stuff' will not be assigned to the value that is input and a "not initialized string" error is generated. If the string is initialized using:

extern string stuff = "some default stringy thingy";

everything works fine
avatar
153
CoenWillemse 2004.12.16 00:53 
Ooopps - this should have been put under the Bug report list: 141.... will do that now to save confusion.
Back to topics list  
Download MetaTrader 5 (450 Kb, web installer) — a new terminal for financial markets