PQOTD
-
The right hand operand of a || shall not contain side effects
The operands of a logical || shall be primary expressionsThe example you gave is the very reason for the above two rules.
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus Entropy isn't what it used to.
I never follow other peoples' rules. :cool:
You'll never get very far if all you do is follow instructions.
-
You have to! Otherwise you may end up with some mess if updating C/C++ to C# (what I'm doing just now)...
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
-
Nah! As long as it compiles...
- I would love to change the world, but they won’t give me the source code.
Yeah! It compiles. After then you can rub your head to find where the bug is!
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
-
Programming Quiz of the day. I just wrote this code (C#), which did something very unexpected. What was it that it unexpectedly did?
bool more = ProcessFlyouts(); more = more || ProcessCarrierAnimations();
How would you change it to "do the right thing?" Marc
How about:
more &= ProcessCarrierAnimations();
The difficult we do right away... ...the impossible takes slightly longer.
-
Programming Quiz of the day. I just wrote this code (C#), which did something very unexpected. What was it that it unexpectedly did?
bool more = ProcessFlyouts(); more = more || ProcessCarrierAnimations();
How would you change it to "do the right thing?" Marc
Is it just me that would have done it as a oneliner?
Wrong is evil and must be defeated. - Jeff Ello[^]
-
Is it just me that would have done it as a oneliner?
Wrong is evil and must be defeated. - Jeff Ello[^]
That could make setting a breakpoint on the second call difficult. :shrug:
You'll never get very far if all you do is follow instructions.
-
That could make setting a breakpoint on the second call difficult. :shrug:
You'll never get very far if all you do is follow instructions.
No big deal to change if necessary. :shrug: But I actually find it easier to read on one line.
Wrong is evil and must be defeated. - Jeff Ello[^]
-
Programming Quiz of the day. I just wrote this code (C#), which did something very unexpected. What was it that it unexpectedly did?
bool more = ProcessFlyouts(); more = more || ProcessCarrierAnimations();
How would you change it to "do the right thing?" Marc
-|
Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. "And they, since they Were not the one dead, turned to their affairs" -- Robert Frost "All users always want Excel" --Ennis Lynch
-
Programming Quiz of the day. I just wrote this code (C#), which did something very unexpected. What was it that it unexpectedly did?
bool more = ProcessFlyouts(); more = more || ProcessCarrierAnimations();
How would you change it to "do the right thing?" Marc
There's a risk that
ProcessCarrierAnimations()
may never be invoked, so the right thing (IMHO) would be to do something like this:bool processFlyouts = ProcessFlyouts();
bool processCarrierAnimations = ProcessCarrierAnimations();
bool more = processFlyouts || processCarrierAnimations;/ravi
My new year resolution: 2048 x 1536 Home | Articles | My .NET bits | Freeware ravib(at)ravib(dot)com
-
Kornfeld Eliyahu Peter wrote:
you have to switch the order
Yes indeed. Or use the bitwise operator. Marc
-
Programming Quiz of the day. I just wrote this code (C#), which did something very unexpected. What was it that it unexpectedly did?
bool more = ProcessFlyouts(); more = more || ProcessCarrierAnimations();
How would you change it to "do the right thing?" Marc
-
Yeah! It compiles. After then you can rub your head to find where the bug is!
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
Kornfeld Eliyahu Peter wrote:
It compiles. After then you someone else will can rub your their head to find where the bug is!
FTFY :-D
The report of my death was an exaggeration - Mark Twain
Simply Elegant Designs JimmyRopes Designs
I'm on-line therefore I am. JimmyRopes -
Programming Quiz of the day. I just wrote this code (C#), which did something very unexpected. What was it that it unexpectedly did?
bool more = ProcessFlyouts(); more = more || ProcessCarrierAnimations();
How would you change it to "do the right thing?" Marc
It compiled?
========================================================= I'm an optoholic - my glass is always half full of vodka. =========================================================
-
I never follow other peoples' rules. :cool:
You'll never get very far if all you do is follow instructions.
-
Programming Quiz of the day. I just wrote this code (C#), which did something very unexpected. What was it that it unexpectedly did?
bool more = ProcessFlyouts(); more = more || ProcessCarrierAnimations();
How would you change it to "do the right thing?" Marc
-
Programming Quiz of the day. I just wrote this code (C#), which did something very unexpected. What was it that it unexpectedly did?
bool more = ProcessFlyouts(); more = more || ProcessCarrierAnimations();
How would you change it to "do the right thing?" Marc
Just to be contrary:
bool more = false;
if (ProcessFlyouts()) more = true;
if (ProcessCarrierAnimations()) more = true;Software Zen:
delete this;
-
|
Regards, Nish
Blog: voidnish.wordpress.com Latest article: C++ 11 features in Visual C++ 2013 Preview
Yuck. One of my least favorite things when reading someone else's C/C++ code is when they mix logical and bit-wise operators in an expression. In this case, using a bit-wise operator on
bool
values just seems wrong.Software Zen:
delete this;
-
Yuck. One of my least favorite things when reading someone else's C/C++ code is when they mix logical and bit-wise operators in an expression. In this case, using a bit-wise operator on
bool
values just seems wrong.Software Zen:
delete this;
I agree, it's not something I'd use myself. I was only answering Marc's academic question :-)
Regards, Nish
Blog: voidnish.wordpress.com Latest article: C++ 11 features in Visual C++ 2013 Preview
-
I agree, it's not something I'd use myself. I was only answering Marc's academic question :-)
Regards, Nish
Blog: voidnish.wordpress.com Latest article: C++ 11 features in Visual C++ 2013 Preview
I thought that was the case - your response just seemed rather unNish-like :laugh:.
Software Zen:
delete this;
-
I thought that was the case - your response just seemed rather unNish-like :laugh:.
Software Zen:
delete this;
Heh :-)
Regards, Nish
Blog: voidnish.wordpress.com Latest article: C++ 11 features in Visual C++ 2013 Preview