Deutsch   English   Français   Italiano  
<875xohbxre.fsf@doppelsaurus.mobileactivedefense.com>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!3.eu.feeder.erje.net!feeder.erje.net!news.in-chemnitz.de!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: Rainer Weikusat <rweikusat@talktalk.net>
Newsgroups: comp.unix.shell,comp.unix.programmer,comp.lang.misc
Subject: Re: Command Languages Versus Programming Languages
Date: Wed, 20 Nov 2024 17:50:13 +0000
Lines: 19
Message-ID: <875xohbxre.fsf@doppelsaurus.mobileactivedefense.com>
References: <uu54la$3su5b$6@dont-email.me> <87edbtz43p.fsf@tudado.org>
	<0d2cnVzOmbD6f4z7nZ2dnZfqnPudnZ2d@brightview.co.uk>
	<uusur7$2hm6p$1@dont-email.me> <vdf096$2c9hb$8@dont-email.me>
	<87a5fdj7f2.fsf@doppelsaurus.mobileactivedefense.com>
	<ve83q2$33dfe$1@dont-email.me> <vgsbrv$sko5$1@dont-email.me>
	<vgtslt$16754$1@dont-email.me> <86frnmmxp7.fsf@red.stonehenge.com>
	<vhk65t$o5i$1@dont-email.me> <vhkev7$29sc$1@dont-email.me>
	<vhkh94$2oi3$1@dont-email.me> <vhkvpi$5h8v$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain
X-Trace: individual.net CkOZwEdFT6Gr00Qv2xiZuQ9NOvkZZbQFjEGgZdVy1I4oQmDgg=
Cancel-Lock: sha1:XjlhxEGeHYRd5TDLXg0JYOJU85E= sha1:BBAipndnc5ZTihIhNzq2/cNgikg= sha256:Nk49T4SFLW+JAoP4gmrEcHywNbKSMCDGfguWSPelZFQ=
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Bytes: 2069

Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:

[...]

> Personally I think that writing bulky procedural stuff for something
> like [0-9]+ can only be much worse, and that further abbreviations
> like \d+ are the better direction to go if targeting a good interface.
> YMMV.

Assuming that p is a pointer to the current position in a string, e is a
pointer to the end of it (ie, point just past the last byte) and -
that's important - both are pointers to unsigned quantities, the 'bulky'
C equivalent of [0-9]+ is

while (p < e && *p - '0' < 10) ++p;

That's not too bad. And it's really a hell lot faster than a
general-purpose automaton programmed to recognize the same pattern
(which might not matter most of the time, but sometimes, it does).