What causes stack overflow error in mql4? - page 2

 
RaptorUK:
If you don't want to post all the code, so that the error can be reproduced, please code something that you can post in full that will reproduce the same error.


See my post just before this.
 
You attached
11/13/2013 03:25 PM 37,911 Ind_error_tester.mq4
11/13/2013 03:25 PM 37,911 Ind_error_tester_Neutralized.mq4
Both files are identical.
 
WHRoeder:
You attached
11/13/2013 03:25 PM 37,911 Ind_error_tester.mq4
11/13/2013 03:25 PM 37,911 Ind_error_tester_Neutralized.mq4
Both files are identical.

Yes sorry. Ive attached again.
 
what with mt4 are we gona be coders or bug collector
 
RaptorUK:
. . . why is your function type int ?
Pity you didn't answer this question . . . make the function a void as it doesn't need to return anything, remove the return(0) recompile, what happens ?
 
Apparently it can't handle that large of a function.
//+-------------------------------------------
//| Custom indicator initialization function  
//+-------------------------------------------
int init()
  {
//---- indicators

int Column1x=10,Column2x=300,Column3x=590,
    Column1xp=70,Column2xp=360,Column3xp=650,
    Column1xg=130,Column2xg=420,Column3xg=710,
    Column1xa=250,Column2xa=540,Column3xa=830;

//---------------USD--------------------------
   //---- EURUSD-------------------
   ObjectCreate("EURUSD", OBJ_LABEL, 0, 0, 0);
 :
   ObjectSet("EURGBP2", OBJPROP_YDISTANCE, ZoomTimes*60);



   ObjectCreate("EURGBP2c", OBJ_LABEL, 0, 0, 0);
:
//+------------------------------------------------------
//| Custom indicator initialization function             
//+------------------------------------------------------
int Column1x=10,Column2x=300,Column3x=590,
    Column1xp=70,Column2xp=360,Column3xp=650,
    Column1xg=130,Column2xg=420,Column3xg=710,
    Column1xa=250,Column2xa=540,Column3xa=830;
int init(){ init1(); init2(); }
int init1()
  {
//---- indicators

//---------------USD------------------------------------
   //---- EURUSD-------------------
   ObjectCreate("EURUSD", OBJ_LABEL, 0, 0, 0);
:
   ObjectSet("EURGBP2", OBJPROP_YDISTANCE, ZoomTimes*60);
}
int init2()
  {
   ObjectCreate("EURGBP2c", OBJ_LABEL, 0, 0, 0);
:
 
RaptorUK:
Pity you didn't answer this question . . . make the function a void as it doesn't need to return anything, remove the return(0) recompile, what happens ?


Yes that also sorts it. BUT why? I mean what if we say the function was an int and we needed the value. Why is it that changing part of the objects solves it wether the function is int or not. Even start, init and deinit are ints and they return(0) so that isnt the issue.
 
WHRoeder:
Apparently it can't handle that large of a function.


whroeder getting what im talking about.
 
tonny:

Yes that also sorts it. BUT why? I mean what if we say the function was an int and we needed the value. Why is it that changing part of the objects solves it wether the function is int or not. Even start, init and deinit are ints and they return(0) so that isnt the issue.
return(0) is returning an int, the int is zero . . . a void doesn't return a value, if you want or return from a void function early you use return;
 
tonny:

whroeder getting what im talking about.
But it can handle that large a function . . . as I explained, change the function type and there is no compilation error for the same size of function . .
Reason: