Boost logo

Boost Users :

Subject: Re: [Boost-users] Why something like #ifndef BOOST_MPI_HPP is alwayscapitalized?
From: Richard Damon (Richard_at_[hidden])
Date: 2008-09-19 19:08:32


On Fri, 19 Sep 2008 15:30:18 -0500, "Peng Yu" <pengyu.ut_at_[hidden]>
wrote:

>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


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net