Is there actually a reason why overloaded && and || don’t short circuit?

All design processes result in compromises between mutually incompatible goals. Unfortunately, the design process for the overloaded && operator in C++ produced a confusing end result: that the very feature you want from && — its short-circuiting behavior — is omitted. The details of how that design process ended up in this unfortunate place, those … Read more

Is the SQL WHERE clause short-circuit evaluated?

ANSI SQL Draft 2003 5WD-01-Framework-2003-09.pdf 6.3.3.3 Rule evaluation order […] Where the precedence is not determined by the Formats or by parentheses, effective evaluation of expressions is generally performed from left to right. However, it is implementation-dependent whether expressions are actually evaluated left to right, particularly when operands or operators might cause conditions to be … Read more

What is the difference between And and AndAlso in VB.NET?

The And operator evaluates both sides, where AndAlso evaluates the right side if and only if the left side is true. An example: If mystring IsNot Nothing And mystring.Contains(“Foo”) Then ‘ bla bla End If The above throws an exception if mystring = Nothing If mystring IsNot Nothing AndAlso mystring.Contains(“Foo”) Then ‘ bla bla End … Read more

Is there a conditional ternary operator in VB.NET?

Depends upon the version. The If operator in VB.NET 2008 is a ternary operator (as well as a null coalescence operator). This was just introduced, prior to 2008 this was not available. Here’s some more info: Visual Basic If announcement Example: Dim foo as String = If(bar = buz, cat, dog) [EDIT] Prior to 2008 … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)