Re: How Come This Binary Op Doesn't Work?

new topic     » goto parent     » topic index » view thread      » older message » newer message

Pete Lomax wrote:
> 
> Jason Gade wrote:
> > Heh, we've discussed this one a lot. Short-circuiting works differently in >
> if and while statements, </font></i>
> For any particular reason? Erm, NO.
> > why not sequence ops?
> You asking me whether we should bastardize the semantics of the language in
> a similar way to perserve sequence ops? Erm, NO.
> 
> Regards,
> Pete
> 
> PS Short-circuiting works exactly the same in if and while statements, of
> course,
> but different in assignment statements, I think you meant.
> 
> PPS I have yet to find a single example in live code where non-short-ciruit
> in assignment is actually taken advantage of - anyone know of any?

It took me a bit to understand what you meant, and then I had my "ah-ha!"
moment. Of course, short-circuiting works in all expressions in C and it makes
sense to do so. It would in Euphoria, too. It shouldn't cause any kind of
performance hit, especially when a short-circuit path is taken. In fact, it
should be a performance benefit if done correctly.

I still vote for comparison operators to work in 'if' and 'while' statements
like they do in any other language.


--
"Any programming problem can be solved by adding a level of indirection."
--anonymous
"Any performance problem can be solved by removing a level of indirection."
--M. Haertel
"Premature optimization is the root of all evil in programming."
--C.A.R. Hoare
j.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu