Warning: mysqli::__construct(): (HY000/1203): User howardkn already has more than 'max_user_connections' active connections in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\includes\artfuncs.php on line 21
Failed to connect to MySQL: (1203) User howardkn already has more than 'max_user_connections' active connectionsPath: ...!news.nobody.at!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Bart
Newsgroups: comp.lang.c
Subject: Re: Command line globber/tokenizer library for C?
Date: Thu, 12 Sep 2024 15:16:02 +0100
Organization: A noiseless patient Spider
Lines: 69
Message-ID:
References:
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 12 Sep 2024 16:16:02 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="3a3e703b62fd17d38a4df729837e6247";
logging-data="304539"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18BinChhd63oz0kOB3gA37M"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:H5oc/gJmV4ZLzr9TEuM24CJSZXc=
In-Reply-To:
Content-Language: en-GB
Bytes: 3726
On 12/09/2024 14:44, Bart wrote:
> On 12/09/2024 13:20, Janis Papanagnou wrote:
>> On 12.09.2024 13:29, Bart wrote:
>>> On 12/09/2024 03:22, Bonita Montero wrote:
>>>> Am 11.09.2024 um 22:19 schrieb Bart:
>>>>
>>>>> C++ is a simpler language? You're having a laugh!
>>>>
>>>> The solutions are simpler because you've a fifth of the code as in C.
>>>>
>>>> In this case, it actually needed somewhat more code, even if the line
>>> count was half.
>>>
>>> But your solutions are always incomprehensible because they strive for
>>> the most advanced features possible.
>>
>> I don't know of the other poster's solutions. But a quick browse seems
>> to show nothing incomprehensible or anything that should be difficult
>> to understand. (YMMV; especially if you're not familiar with C++ then
>> I'm sure the code may look like noise to you.)
>>
>> In the given context of C and C++ I've always perceived the features
>> of C++ to add to comprehensibility of source code where the respective
>> C code required writing clumsy code and needed (unnecessary) syntactic
>> ballast to implement similar functions and program constructs.
>>
>> Your undifferentiated complaint sounds more like someone not willing
>> to understand the other concepts or have a reluctance or laziness to
>> make yourself familiar with them.
>
> I'm saying it's not necessary to use such advanced features to do some
> trivial parsing.
>
> I've given a C solution below.
BTW here are the sources sizes for the tokeniser function. (For C++ I've
included the 'using' statement.)
Spaces Hard tabs
C++ 829 682 characters
C 959 634
M 785 548 (My original of the C version)
So my C version is actually smaller than the C++ when using hard tabs.
In any case, the C++ is not significantly smaller than the C, and
certainly not a fifth the size.
For proper higher level solutions in different languages, below is one
of mine. That function is 107 bytes with hard tabs.
(It's not possible to just split the string on white space because of
quoted items with embedded spaces.)
-------------------------------
func strtoargs(cmdline)=
args::=()
sreadln(cmdline)
while k:=sread("n") do
args &:= k
od
args
end
println strtoargs(getcommandlinea())