[TriEmbed] Hacking a fake vintage radio (with Arduino + Pi 0)

Brian triembed at undecidedgames.net
Thu Jul 9 09:49:24 CDT 2020


On 7/2/20 12:03 PM, Rodney Radford via TriEmbed wrote:
> Technically, 
> you are not supposed to declare a new variable inside a case without 
> using braces to create a new stack frame.

Most compilers won't allow it.  GCC doesn't:

Given this code:
int main(void) {
   int q = 1;
   switch(q) {
     case 0:
       int a = 5;
       break;

     case 1:
       q = 0;
       break;
   }
   return 0;
}

GCC emits this error:
bad_case.cpp: In function ‘int main()’:
bad_case.cpp:8:8: error: jump to case label [-fpermissive]
    case 1:
         ^
bad_case.cpp:5:8: note:   crosses initialization of ‘int a’
     int a = 5;
         ^

MSVC does something similar.

-B




More information about the TriEmbed mailing list