
Thu, 08/28/2008 - 12:31
Forums:
Hi All,
The result type of BRep_Tool::Degenerated is Standard_Boolean, but the definition of a degenerated edge lists as follows:
Standard_Boolean BRep_TEdge::Degenerated()const
{
return myFlags & DegeneratedMask;
}
I wonder know whether is a bug since the result of "myFlags & DegeneratedMask" may be other values except 0 and 1.
-Ding
Thu, 08/28/2008 - 12:49
BRep_Tool::IsClosed is the same.
Mon, 09/01/2008 - 09:07
Dear Cauchy Ding.
The definition of Standard_Boolean is the following:
typedef unsigned int Standard_Boolean;
see Standard_TypeDef.hxx for more details.
Fri, 09/05/2008 - 14:04
This would appear to be a very serious bug if booleans are assumed to be integers by the returning functions. Its fine that they are represented by integers but in doing so the developers should only use 2 values in the integer.
If you need more than 2 values use a different datatype.
Stephen
Wed, 09/10/2008 - 14:31
If you write your code as
if (BRep_Tool::IsDegenerated (myEdge)) {
}
it works fine.
The (potential) bug may though break the construction like this:
if (BRep_Tool::IsDegenerated (myEdge) = Standard_True) {
}
Wed, 09/10/2008 - 14:32
if (BRep_Tool::IsDegenerated (myEdge) == Standard_True) {
}
Wed, 09/10/2008 - 15:27
Dear Roman Lygin.
The method IsDegenerated does not exist in the class BRep_Tool.
Wed, 09/10/2008 - 19:08
Correct, thanks.
Should be BRep_Tool::Degenerated(). That was obvious.
Wed, 09/10/2008 - 15:25
Dear Stephen Leary.
>developers should only use 2 values in the integer.
Why? It is your own opinion. You may use only Standard_True or Standard_False.
In fact developpers can use any unsigned int number (not only Standard_True or Standard_False) for Standard_Boolean variables.
Wed, 09/10/2008 - 19:14
a Boolean is true or false.
if you want to return other values, use a Standard_Integer or an enumeration.
(at least for code readability and maintenance)
So I would typedef Standard_Boolean to bool and for the methods / functions returning something else than Standard_True or Standard_False, change them to return something meaningful.
just my 2 cents,
Stephane
Thu, 09/11/2008 - 08:35
SDear tephane Routelous.
>So I would typedef Standard_Boolean to bool ...
Ok.
Go ahead. I hope that your modifications will be included in next release of Open Cascade.