From: Sven R. <rei...@ma...> - 2002-11-30 15:59:17
|
Looks great. However, I think the code below is incorrect, if I understand the grammar correctly. Stroustrup says something like: The scope of a name starts at the point of its declaration; i.e., after the complete declarator and before the initializer (Stroustrup, 4.9.4, translated back from German). That means that in the line > int x = x * taxeRate; the second x already refers to the new variable, i.e., its uninitialized value. So, it should be left unchanged, rather than being refactored to > int x = price * taxeRate; This is just my theoretical understanding; I'll check if the compiler understands the standard in the same way. If this is true, it should make the refactoring even easier. Sven. -- Sven Reichard Dept. of Math. Sci. University of Delaware rei...@ma... |