|
-
declaring new variables within a switch statement
hello,
does anyone know if declaring new variables within a switch statement (inside of case: break actually creates new variables inside those switch statements, or are the variable declarations moved to the top of the function when compiled?
i know that when declaring new variables inside a for or while loop, the compiler declares those variables at the beginning of the function. is it the same for if or switch statements?
-
Is this a question of how the compiler works, or whether you'd have access to the newly declared variable within the scope of the function, after the switch-case, for use in returning or for some other purpose?
-
i'm wondering how the compiler works... mainly, if i have a huge switch statement full of tons of different cases and each creates a lot of new variables within, does it heavily slow down the main program, or just each separate case branch?
-
I'm not much of an engineer when it comes to this type of stuff, so I really can't answer that question. Wish I could help!
I'm sure someone will come along and take a look eventually and have an answer for you. =)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|