Case switch using array doesn't work after build 600

 

Hi There!

Can anybody explain to me why this piece of code:

int Day_Of_Week_Array[];
{

switch(Day())
{
case 15: Day_Of_Week_Array[1] = {3}; break
case 16: Day_Of_Week_Array[2] = {3,4}; break;
case 17: Day_Of_Week_Array[3] = {3,4,5}; break;
case 18: Day_Of_Week_Array[4] = {3,4,5,6}; break;
case 19: Day_Of_Week_Array[5] = {3,4,5,6,0}; break;
case 20: Day_Of_Week_Array[6] = {3,4,5,6,0,1}; break;
}

}

Does not work anymore after the build 600 (and up) update? Instead I get the following error message(s) :

'{' - expression expected

for every "case" line. So something seems to have changed in the way I need to declare arrays in a case switch function, but how did it change? The exact same code worked in builds prior to 600.

Thanks for your help! If you need more info, just let me know, cause this is all new to me.

Bst rgds,Arjan

 

Hello,

Please use the SRC button when you post code. Thank you.


By the way the code you post has never compiled on any build. I suggest you to check the documentation.

 
angevoyageur:


By the way the code you post has never compiled on any build. I suggest you to check the documentation.

i also thought it's not been compiling pre B600 but i had to check it just for the curiosity completely unexpectedly it's get compiled on pre B600

note: it's not a function (i have been confused at first, and thought it's a function)

 
int Day_Of_Week_Array[];

switch(Day())
   {
   case 15: ArrayResize(Day_Of_Week_Array, 1);
            Day_Of_Week_Array[0] = 3;
            break;
   case 16:  
            ArrayResize(Day_Of_Week_Array, 2);
            Day_Of_Week_Array[0] = 3;
            Day_Of_Week_Array[1] = 4;
            break;
   case 17: ...
        ...
   default: ...
   } 
 
qjol:

i also thought it's not been compiling pre B600 but i had to check it just for the curiosity completely unexpectedly it's get compiled on pre B600

note: it's not a function (i have been confused at first, and thought it's a function)

The posted code has never compiled on any build.

        case 15: Day_Of_Week_Array[1] = {3}; break  

semicolon is missing

But to be honest this was not my first idea.

 
angevoyageur:

The posted code has never compiled on any build.

semicolon is missing


angevoyageur:

But to be honest this was not my first idea.


i know (guess) you thought it's function (same as i thought)
 
qjol:


i know (guess) you thought it's function (same as i thought)


Yes.
 
completely understandable... because of the unnecessary parentheses
 

Hi everyone,

INdeed it's just like qjol said, it did indeed work on pre B600. The missing semicolon was just because of sloppy copy and paste work on my side. Next time I'll use the SRC button as suggested. Anyway, qjol code suggestion now works fine, so thanks a lot!

Reason: