|Message: graphics_reps\src\BooleanProcessor.src question||Not Logged In (login)|
Click on the Forum title, e.g. on the "Forums by Category" page, to read a sequence of postings to the Forum and its threads all in one page. If you are only interested in one thread or the thread following a specific posting, click the thread or the posting, which takes you to a smaller page, which contains only the part you are interested in and may be easier to navigate.
Messages are "chained" if there are only replies at the first level, i.e. 1/1.html, 1/1/1.html etc. In case of "chained" messages the message number is replaced by the icon and there is no indentation.
Inline: Display the subject line only or also the text of the posting(s); for the choice "All" the "Outline" choices are switched off.
|1||0||1||no text / full text of posting|
|2||1||All||text for level 1 only / text for All postings|
Outline: Choose the depth of the posting thread, successive toggle controls provide increasing detail.
|1||2||1||2 levels / 1 level (original posting)|
|2||3||2||3 levels / 2 levels|
|3||3||All||3 levels / all levels (all postings)|
During compilation from scratch of the ver. 9.5 geant4 code (using Visual Studio 2008 Express), I saw a warning that I believe warrants some investigation. The file
has the following lines:
edges.push_back(ExtEdge(k, k, i, -(edges.size()+1), -1)); . . . edges.push_back(ExtEdge(k, k, i, -(edges.size()-1), -1));
And a few similar lines later in the code.
My concern is related to the warning my compiler issues:
e:\geant4\g4-vs2008-ver9.5\geant4_9_5\source\graphics_reps\src\BooleanProcessor.src(1553) : warning C4146: unary minus operator applied to unsigned type, result still unsigned
This tells me that it is possible that the logic of the code assumes that the expression -(edges.size()-1) is assumed to be allowed to be negative. However, it will remain non-negative because the value of edges.size() is of the type “unsigned” (specifically, “size_t”). Subtracting 1 from it doesn’t change its type. After that, applying unary minus operand, as the compiler says, will not change its type either, and the resulting action of the code may be unpredictable. It is my understanding that to achieve proper functionality one need to cast the edges.size(), as say, static_cast<int>( edges.size()), and then all result immediately will go into the realm if integers and applying a unary minus to say, a value of 5 will result in -5 and not in some crazy value.
Since I did not follow the logic of each step in this code, I may be mistaken in my interpretation of the author’s intention. If the author indeed wanted to operate in unsigned numbers only, the code is correct. However, if the author wanted to have the full realm of integers (why else would you apply a unary minus?), there may be an imperfection in the code. (Or, simply put, it will not work as intended.)
Naval Research Laboratory
|Inline Depth:||Outline Depth:||Add message:|