It is currently Mon Dec 17, 2018 11:33 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 27 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: Faulty And/Or Processing
PostPosted: Fri Jun 10, 2016 11:45 am 
Offline
Addict
Addict

Joined: Thu Aug 30, 2007 11:54 pm
Posts: 870
Location: right here
i didn't know the PB short-circuit was actually documented :)

i usally even tend to write
Code:
If (Not a) And b
though i know that Not has higher presedence than And.
i find with the braces you qickly get some geometry/nesting visualized, just as indentation does. you wouldn't omit the indentation, even not for three lines of code, though its actually redundant.

but as i read, others perceive different, some say they get an expression quicker without braces.


Top
 Profile  
Reply with quote  
 Post subject: Re: Faulty And/Or Processing
PostPosted: Fri Jun 10, 2016 1:30 pm 
Offline
Addict
Addict

Joined: Mon Feb 16, 2015 2:49 pm
Posts: 1667
DontTalkToMe wrote:
Don't you realize what you are saying it's nonsense ?

Yeah, I misread the code example. :oops:


Top
 Profile  
Reply with quote  
 Post subject: Re: Faulty And/Or Processing
PostPosted: Fri Jun 10, 2016 4:49 pm 
Offline
Enthusiast
Enthusiast

Joined: Mon Feb 04, 2013 5:28 pm
Posts: 332
@Dude, that's a relief :wink:

Since you removed everything I edited my message where I was barking at you :D


Top
 Profile  
Reply with quote  
 Post subject: Re: Faulty And/Or Processing
PostPosted: Fri Jun 10, 2016 5:44 pm 
Offline
Addict
Addict
User avatar

Joined: Tue Nov 09, 2010 10:15 pm
Posts: 1497
Keya wrote:
its always been a habit of mine to uses brackets even where not needed, such as A = A + (B * C)
is this considered bad practice in those cases? or does it not really matter?


It is never bad practice to reduce ambiguity. It is always good practice to increase clarity.

The addition of parentheses (or brackets) only clarifies, and makes the code more portable. With the parens, you are not relying on the compiler and its precedence as much as you are relying on solid portable code. I would not say that omitting them is not bad, though.

The PowerBasic code at the top of this thread is the perfect example of this. It worked there, and someone hoped and/or assumed it would work with pb, and that was not the case. Had the parens been added in the first place, there would not be a reason for this thread.


Top
 Profile  
Reply with quote  
 Post subject: Re: Faulty And/Or Processing
PostPosted: Fri Jun 10, 2016 6:00 pm 
Offline
Enthusiast
Enthusiast

Joined: Mon Feb 04, 2013 5:28 pm
Posts: 332
Tenaja wrote:
The PowerBasic code at the top of this thread is the perfect example of this. It worked there, and someone hoped and/or assumed it would work with pb,


I disagree with that. It does not work because the compiler it's bugged, not because it decided to follow a personal boolean logic we (and the rest of the world) need to learn.

Tenaja wrote:
Had the parens been added in the first place, there would not be a reason for this thread.


The bug would not be known then, but actually was already known, and it will be discovered again.


Top
 Profile  
Reply with quote  
 Post subject: Re: Faulty And/Or Processing
PostPosted: Fri Jun 10, 2016 6:29 pm 
Offline
Addict
Addict
User avatar

Joined: Tue Dec 23, 2003 3:54 am
Posts: 1574
Code:
True = #True
Debug Bool(  True And #True Or #False)
Debug Bool( #True And  True Or #False)


It's a bug. Parentheses can be used to work around it, but shouldn't be used to hide this bug for more years.


Top
 Profile  
Reply with quote  
 Post subject: Re: Faulty And/Or Processing
PostPosted: Fri Jun 10, 2016 6:54 pm 
Offline
Addict
Addict
User avatar

Joined: Tue Nov 09, 2010 10:15 pm
Posts: 1497
My statement was in response to asking if it is bad practice to use parens.

It is never bad practice. Bugs or not. Whether Fred and Freak decide the bugs are tolerable is a different topic.

Either way, it is still true that had the original author of Power code used parens, and carried them over to PB, it would not be a topic of discussion in this thread.


Top
 Profile  
Reply with quote  
 Post subject: Re: Faulty And/Or Processing
PostPosted: Fri Jun 10, 2016 7:07 pm 
Offline
Enthusiast
Enthusiast

Joined: Mon Feb 04, 2013 5:28 pm
Posts: 332
Tenaja wrote:
Either way, it is still true that had the original author of Power code used parens, and carried them over to PB, it would not be a topic of discussion in this thread.


Absolutely, and luckily he didn't, so this thread exists, mirroring the previous ones but with some more flavor added.

My response instead was to you because I read some kind of reprimand directed to the OP because he dared to think that code would have worked here too. "someone hoped and/or assumed it would work with pb".
Because it was a legitimate assumption. We are talking about some ANDs and one OR. Maybe I read too much in it, but just to be on the safe side ... in case I did sorry to have misunderstood you.


Top
 Profile  
Reply with quote  
 Post subject: Re: Faulty And/Or Processing
PostPosted: Sat Jun 11, 2016 8:59 pm 
Offline
User
User

Joined: Thu Aug 28, 2014 9:02 pm
Posts: 62
I think that this thread has established that, relative to other languages that
we are familiar with, PureBasic is not processing the And/Or combination correctly.

If this is some maverick feature of PureBasic then it should be noted in the Help
text, otherwise, it must be considered a bug.

This anomaly was reported at least 7 years ago and has not been fixed to date. This
is disturbing because with out the correct processing of conditional clauses, a
computer is nothing more than a simple adding machine with memory.

If the PureBasic team responds to this, their comments are awaited with interest.


Top
 Profile  
Reply with quote  
 Post subject: Re: Faulty And/Or Processing
PostPosted: Sun Jun 12, 2016 6:57 am 
Offline
Addict
Addict

Joined: Mon Feb 16, 2015 2:49 pm
Posts: 1667
Thanks, DTTM. :)


Top
 Profile  
Reply with quote  
 Post subject: Re: Faulty And/Or Processing
PostPosted: Thu Jun 16, 2016 4:43 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Fri Oct 06, 2006 4:41 am
Posts: 629
Location: Canada
kenmo wrote:
Code:
True = #True
Debug Bool(  True And #True Or #False)
Debug Bool( #True And  True Or #False)

@kenmo : I admire the brevity and clarity of your demonstration.
Just the essentials. It does not get better.

@ANDY ANDERSON : great summation !

When is that very basic bug finally going to be corrected ?

_________________
"That's not a bug..." said the programmer. "...It's a feature! "
"Oh! I see..." replied the blind man.


Last edited by Blue on Thu Jun 16, 2016 4:59 am, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Faulty And/Or Processing
PostPosted: Thu Jun 16, 2016 4:52 am 
Offline
Addict
Addict
User avatar

Joined: Tue Mar 21, 2006 12:31 am
Posts: 1773
Location: Canada
Blue wrote:
kenmo wrote:
Code:
True = #True
Debug Bool(  True And #True Or #False)
Debug Bool( #True And  True Or #False)


@kenmo : I admire the brevity and clarity of your demonstration.
Just the essentials. It does not get better.

@ANDY ANDERSON : great summation !

When is that very basic bug finally going to be corrected ?


Well said..! by both! :)

_________________
ʽʽSuccess is almost totally dependent upon drive and persistence. The extra energy required to make another effort or try another approach is the secret of winning.ʾʾ --Dennis Waitley


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 27 posts ]  Go to page Previous  1, 2

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye