Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: ulm@g.o, python@g.o
Subject: Re: [gentoo-dev] [New eclass] twisted-r1.eclass
Date: Sat, 03 Aug 2013 19:42:13
Message-Id: 20130803214220.6fd4b476@gentoo.org
In Reply to: Re: [gentoo-dev] [New eclass] twisted-r1.eclass by Ulrich Mueller
1 Dnia 2013-08-03, o godz. 21:37:10
2 Ulrich Mueller <ulm@g.o> napisał(a):
3
4 > >>>>> On Sat, 3 Aug 2013, Michał Górny wrote:
5 >
6 > > Dnia 2013-08-03, o godz. 17:54:42 Ulrich Mueller <ulm@g.o>
7 > > napisał(a):
8 >
9 > >> This looks just horrible. You do decimal arithmetic on octal
10 > >> numbers?
11 >
12 > > Yes. Bash wasn't really happy to do octal arithmetic for me. Yet in
13 > > this particular case, with proper assumptions, decimal arithmetic is
14 > > practically equivalent.
15 >
16 > Do you consider that in future maybe someone else has to maintain that
17 > code? IMHO we should avoid such hacks.
18
19 Well, the code isn't really supposed to need much maintenance. And it
20 becomes obsolete as soon as we switch to bash-4. I've already added
21 additional:
22
23 if [[ ${BASH_VERSINFO[0]} -ge 4 ]]; then
24 echo -n "${w^}"
25 else
26 # current snippet
27 fi
28
29 Anyway, given the comments and specific case, I doubt it should be
30 a real issue.
31
32 > Why don't you do the calculations in decimal throughout? You can
33 > convert to octal (using printf) in the last step.
34
35 I consider that a pointless conversion, esp. that it doesn't
36 make a difference code-wise.
37
38 --
39 Best regards,
40 Michał Górny

Attachments

File name MIME type
signature.asc application/pgp-signature