3 ms·
This is one of those times when, for all its verbosity, Ada got it right. For boolean conjunction you must choose between writing "A and B", or "A and then B".
by gmfawcett 5y ago
This is one of those times when, for all its verbosity, Ada got it right. For boolean conjunction you must choose between writing "A and B", or "A and then B". The "and then" version is short circuiting, while the bare "and" version is not.
- shawnz 5y agoVisual Basic also has this distinction (but the keywords are "And" and "AndAlso")
- gene91 5y agoThis is a typo of missing an ampersand. If the author were writing Ada, it would have been a typo of missing a “then”. How is it different?
- Cthulhu_ 5y agoIt's different because in C it changes a boolean comparison to a bitwise one. Is Ada's `and` a bitwise and?
- gpderetta 5y agoFor bool there is no difference between bitwise and and logical and. There is a difference between short-circuiting and non short-circuiting and, hence the distinct operators.
- thesuperbigfrog 5y agoThe equivalent Ada code does not exist as the Ada boolean type only has a logical AND operator (no bitwise operations exist): http://www.ada-auth.org/standards/12rm/html/RM-A-1.html#I5384 http://www.ada-auth.org/standards/12rm/html/RM-A-1.html#I538...