If it were not an operator
-
C++ code (simplified), VS2005:
if (!DescribeFG(PARAM_1, &vVal, iIndex ), iType)
{
DisplayError();
}With following prototype
bool DescribeFG(int a, int *value, int index, int type=0);
I do not know how the if line was understood by the compiler, but no error, no warning. Maybe the , operator ? Actually, I searched quite a while why my type was always 0 (original code is not that trivial) :~
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
Do not feed the troll ! - Common proverb -
C++ code (simplified), VS2005:
if (!DescribeFG(PARAM_1, &vVal, iIndex ), iType)
{
DisplayError();
}With following prototype
bool DescribeFG(int a, int *value, int index, int type=0);
I do not know how the if line was understood by the compiler, but no error, no warning. Maybe the , operator ? Actually, I searched quite a while why my type was always 0 (original code is not that trivial) :~
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
Do not feed the troll ! - Common proverbIMO there is no error, it looks like valid C++ code; it does demonstrate the "synergy of two language features" both deemed unnecessary in C#. :)
Luc Pattyn [Forum Guidelines] [My Articles]
Happy 2008!
-
C++ code (simplified), VS2005:
if (!DescribeFG(PARAM_1, &vVal, iIndex ), iType)
{
DisplayError();
}With following prototype
bool DescribeFG(int a, int *value, int index, int type=0);
I do not know how the if line was understood by the compiler, but no error, no warning. Maybe the , operator ? Actually, I searched quite a while why my type was always 0 (original code is not that trivial) :~
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
Do not feed the troll ! - Common proverbIf I recall correctly, the comma operator returns the last value in the list. int x = 1, 2, 3, 4, 5; will assign x the value 5.
-- Raaaaaaaaaaaaaaaaaaaaa!
-
C++ code (simplified), VS2005:
if (!DescribeFG(PARAM_1, &vVal, iIndex ), iType)
{
DisplayError();
}With following prototype
bool DescribeFG(int a, int *value, int index, int type=0);
I do not know how the if line was understood by the compiler, but no error, no warning. Maybe the , operator ? Actually, I searched quite a while why my type was always 0 (original code is not that trivial) :~
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
Do not feed the troll ! - Common proverbCheck out this[^]. It gives an example below. Basically, your method is called with three parameters (using the default for type). Then to evaluate the if-statement it would take the last "part". So if it was logically "!false, 1", then 1 would be evaluated as the condition for the if-statement.
Take care, Tom ----------------------------------------------- Check out my blog at http://tjoe.wordpress.com
-
C++ code (simplified), VS2005:
if (!DescribeFG(PARAM_1, &vVal, iIndex ), iType)
{
DisplayError();
}With following prototype
bool DescribeFG(int a, int *value, int index, int type=0);
I do not know how the if line was understood by the compiler, but no error, no warning. Maybe the , operator ? Actually, I searched quite a while why my type was always 0 (original code is not that trivial) :~
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
Do not feed the troll ! - Common proverbRage wrote:
Maybe the , operator ?
Of course, with default parameter complicity. :)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
[my articles]