+ 1
Switch statement in c++/java: "case values"
why in c/c++ and java case values should be compile-time constant?! and what's difference between multiple if and switch statement at speed of program? i didn't see any notable difference(with multiple if statement) in generated assembly code!
7 Answers
+ 2
Martin Taylor
ok. i see.
thanks.
+ 1
Martin Taylor Yeah.
actually i meant multiple if-else.
thank you.
+ 1
Martin Taylor
i know compiler resolve sizeof(staticarray) at compile time.
but How does the program remember the length of the dinamic array?
delete[] arr;
i think it needs to know how many bytes are allocated. (to free them)
+ 1
Martin Taylor oh I thought there's no runtime management in c++.
thanks.