[SM-Discuss] g++ 4.3.0

Jaka Kranjc smgl at lynxlynx.info
Thu Apr 10 03:27:43 EDT 2008


On Thursday 10 of April 2008 05:34:57 Ismael Luceno wrote:
> > There should be a function to compare versions, something like:
> >
> > sver() {
> > 	echo $(( `sed -e 's/\./ * 2048 + /g'` ))
> > }
> >
> > I guess 11bit padding is enough...
>
> Ouch, that's wrong. A friend suggested this:
>
> echo $((sed -e ':loop;s/\([^.-]*\)[.-]/(\1) * 2048 + /;tloop' ))
>
> Still, it has some problems:
> - it should not be sensible to changes like 1.9.2 to 1.9.2.1
> - it should support letters in the version
Luckily the version patterns don't change much with individual spells and such 
comparisons are not needed often, so approaching them individually is fine. 
Writting a truly generic comparison function would be a waste of time.

LP

-- 
We cannot command nature except by obeying her.  --Sir Francis Bacon
Have a sourcerous day! www.sourcemage.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 315 bytes
Desc: This is a digitally signed message part.
Url : http://lists.ibiblio.org/pipermail/sm-discuss/attachments/20080410/5d5f5ab7/attachment-0001.bin 


More information about the SM-Discuss mailing list