On Fri, 19 Sep 2008 15:30:18 -0500, "Peng Yu"
Hi,
I'm wondering how you would handle the following case.
Suppose I have a set of mathematical formulas that has both bigger case and lower case variables (such as both 'X' and 'x'). This situation is pretty common. In order to implement them in C++, I could either write bigger cases as well as lower cases in C++, which is not in consistence with the convention that you mention. Or I have to convert bigger cases to lower cases, which is also not easy to read, as it is different from the original mathematical form.
Which approach would you prefer? I would prefer the former one. Therefore, the convention is not followed.
Thanks, Peng
First, I would say that in general a variable name as short as "x" is not usually desirable unless it is of very small scope as you are so apt to have multiple equations using the same symbol x to represent different things in the larger scope. The fact that you have two "x"s needing to be represented this way is a sign of this. In your equations, since normally equations use single letter symbols (since multiple letter together tend to imply multiplication of several variables). Somewhere off to the side is probably a key defining small x to be one thing and big X to be another, so you can go with names from that, or small_x / big_x or even x / xx (I prefer the first more descriptive unless it is a very small scope with comments defining the mapping). Richard Damon