On 27 Nov 2009, at 11:44, Graeme Geldenhuys wrote:
diff --git a/packages/ibase/src/ibase60.inc b/packages/ibase/src/
ibase60.inc
index 5bc668d..54e2ab3 100644
--- a/packages/ibase/src/ibase60.inc
+++ b/packages/ibase/src/ibase60.inc
@@ -2647,8 +2647,9 @@ begin
end
else
begin
- If (TryInitialiseIBase60(fbclib)=0) and
- (TryInitialiseIBase60(gdslib)=0) then
+ If (TryInitialiseIBase60(fbclib+'.2')=0) and // major
versioned
+ (TryInitialiseIBase60(fbclib)=0) and // un-versioned
+ (TryInitialiseIBase60(gdslib)=0) then // backward
compatibility
Raise EInOutError.CreateFmt(SErrDefaultsFailed,
[gdslib,fbclib]);
end;
Result := RefCount;
----------------------------------------
What I don't like about the patch above, is the 'and' statement.
Wouldn't it be better (optimised) to do the following:
if not v2 found then // libfbclient.so.2
if not unversioned found then // libfbclient.so
if not gds found then // libgds.so
raise Exception.Create(...)
That way it will stop at the first if that found a valid library.
The first form will do that as well. See "short-circuit evaluation" at
http://www.freepascal.org/docs-html/ref/refsu31.html
Jonas
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel