473,387 Members | 1,379 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Re: if / else statements not symmetric

Actually I think the code you have in mind is:

#1: *if (X) {A} else if (!X) {B}
#2: *the same

Anything that evaluates X more than once is not correct compilation of the code you originally gave.
Thanks for replying. I took a look at the code I had in mind, and it
was not if/elseif. However, it was a very complex piece of code,
involving evaluating a function that returns a bool [in other words if
(function_returns_bool(x,y,z)) {} else {}].

What I did was make the function return the opposite of what it was
returning, (ie. true instead of false) and the program worked
flawlessly, whereas before it was an infinite loop for the reasons I
gave in the OP.

However, I grant that perhaps this fix was due to some peculiarities
of the function, not the if/else statement, so I will retract my
original statement.

RL

Sep 8 '08 #1
1 1444
On Sep 8, 1:09*pm, raylopez99 <raylope...@yahoo.comwrote:

<snip>
However, I grant that perhaps this fix was due to some peculiarities
of the function, not the if/else statement, so I will retract my
original statement.
And the lesson is: before asserting that a language behaves oddly, try
to find a *simple* example which will demonstrate the issue. If you
manage to find a simple example, that's great and it will add weight
to your complaint. If you can't find a simple example, the problem
probably lies in your complicated code.

Jon
Sep 8 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: kiran | last post by:
Hi , I need some helpon Symmetric Crptography algorithm. My friend has given a encrypted message ( encrypted using Symmetric cryptogrraphy algorithm and he does 't mention on which plat form is...
0
by: Summa | last post by:
I write encrypt symmetric key using X509 Certificate public key and write to a XML file. RijndaelManaged sCipher = new RijndaelManaged(); byte EnKey = sRSA.Encrypt(sCipher.Key,false); ...
23
by: bearophileHUGS | last post by:
So far in Python I've almost hated the 'else' of the 'for' loops: - I have problems to remember its meaning; - It gives me little problems when I later want to translate Python code to other...
0
by: =?ISO-8859-1?Q?G=F6ran_Andersson?= | last post by:
MC wrote: No, the problem is not with the compiler, but with the poster. What he describes does not happen, he just invents things like this to troll the newsgroup. -- Göran Andersson
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.