Gentoo Archives: gentoo-dev

From: Steve Long <slong@××××××××××××××××××.uk>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] Re: Re: [gentoo-commits] gentoo-x86 commit in dev-dotnet/libgdiplus: ChangeLog libgdiplus-1.2.5-r1.ebuild
Date: Wed, 26 Sep 2007 10:43:00
Message-Id: fddb2h$koj$1@sea.gmane.org
In Reply to: [gentoo-dev] Re: Re: [gentoo-commits] gentoo-x86 commit in dev-dotnet/libgdiplus: ChangeLog libgdiplus-1.2.5-r1.ebuild by Steve Long
1 Steve Long wrote:
2
3 > Bo Ørsted Andresen wrote:
4 >
5 >> On Monday 24 September 2007 21:56:49 Donnie Berkholz wrote:
6 >>> > if [[ "$(gcc-major-version)" -gt "3" ]] || \
7 >>> > ( [[ "$(gcc-major-version)" -eq "3" ]] && [[ "$(gcc-minor-version)"
8 >>> > -gt "3" ]] )
9 >>>
10 >>> Code block { } might be good here instead of a subshell, or perhaps it
11 >>> could use logic that's less convoluted such as if..then. Also don't need
12 >>> the double quotes.
13 >>
14 >> Or it could be as simple as:
15 >>
16 >> if [[ $(gcc-major-version) -gt 3 || \
17 >> ( $(gcc-major-version) -eq 3 && $(gcc-minor-version) -gt 3 ) ]]
18 >>
19 >> [[ allows grouping of conditions without spawning subshells.
20 >>
21 > http://wooledge.org/mywiki/BashFAQ#faq31 explains the differences between
22 > [[ and [, although in this case I'd use:
23 > if ((gcc-major-version>3 || (gcc-major-version==3 && gcc-minor-version>3)
24 > ))
25 >
26 > "As a rule of thumb, [[ is used for strings and files. If you want to
27 > compare numbers, use an ArithmeticExpression."
28 >
29 >
30 Er missed that it's a function call (thanks zlin) but the general point
31 applies (and tbh I wouldn't call the function twice in any case, so
32 Donnie's point re logic might be more cogent.)
33
34
35 --
36 gentoo-dev@g.o mailing list