en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en en nl en en en en en en de en en en en en nl en en en en en fr en en fr en da en en en en de en en en fr en en en en en en en en en pt en en en en en en
By logging into your account, you agree to our Privacy Policy, personal data processing and storage practices as described therein.
Forgot password or user name?
Search in titles only Search in Programming only
You are not logged in. You can browse in the PowerBASIC Community, but you must click Login (top right) before you can post. If this is your first visit, check out the FAQ or Sign Up.
Question About Bitwise Expression in If
All Time Today Last Week Last Month
All Discussions only Photos only Videos only Links only Polls only Events only
Join Date: Jul 2000
Question About Bitwise Expression in If
12 Mar 2008, 05:19 PM
In following code control should not got to ReplaceMonthName SUB but only first "If" works correctly. Can anyone explain why this is so?
%UsesMonthNames = 1 %DelimiterSlash = 2 %DelimiterDot = 4 %DelimiterDash = 8 %YearFirst = 16 %YearMiddle = 32 %YearLast = 64 %MonthFirst = 128 %MonthMiddle = 256 %MonthLast = 512 %DayFirst = 1024 %DayMiddle = 2048 %DayLast = 4096 %Y2 = 8192 %Y4 = 16384 DateFormat = 20752 If (DateFormat And %UsesMonthNames) Then ReplaceMonthName D$ End If If DateFormat And %UsesMonthNames Then ReplaceMonthName D$ End If
Join Date: Aug 1998
12 Mar 2008, 05:26 PM
Because that's how "short circuit" evaluation works in the compiler.
IF A and B THEN " tests A; if A is false, B is never tested and THEN is not executed; THEN will execute whenever (and only whenever) both A and B are true.
"IF (A AND B) THEN" first bitwise-ANDs A with B, then tests that result versus zero; if non-zero, THEN is executed. Meaning, both A and B could be TRUE, but THEN won't necessarily execute
Port Washington WI USA
Copyright © 1998-2022 PowerBASIC Tools, LLC - All Rights Reserved.
Powered by vBulletin® Version 5.7.0
Copyright © 2022 vBulletin Solutions, Inc. All rights reserved.
All times are GMT-5. This page was generated at 01:42 AM.
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.