Deutsch   English   Français   Italiano  
<20250320171505.221@kylheku.com>

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

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: Kaz Kylheku <643-408-1753@kylheku.com>
Newsgroups: comp.lang.c
Subject: Re: Suggested method for returning a string from a C program?
Date: Fri, 21 Mar 2025 00:46:53 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 76
Message-ID: <20250320171505.221@kylheku.com>
References: <vrd77d$3nvtf$2@dont-email.me> <868qp1ra5f.fsf@linuxsc.com>
 <vrdhok$47cb$2@dont-email.me> <20250319115550.0000676f@yahoo.com>
 <vreuj1$1asii$4@dont-email.me> <vreve4$19klp$2@dont-email.me>
 <20250319201903.00005452@yahoo.com> <86r02roqdq.fsf@linuxsc.com>
 <vrh1br$35029$2@dont-email.me> <LRUCP.2$541.0@fx47.iad>
 <vrh71t$3be42$1@dont-email.me> <874izntt5t.fsf@nosuchdomain.example.com>
 <vrhviu$h5c$1@dont-email.me> <87ecyrs332.fsf@nosuchdomain.example.com>
 <vri9t1$a29t$1@dont-email.me>
Injection-Date: Fri, 21 Mar 2025 01:46:54 +0100 (CET)
Injection-Info: dont-email.me; posting-host="df58305735356133a1d50f0f51c347a6";
	logging-data="422712"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18DdVooAw/inBz/lBElol9uT7dEodGDVAw="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:OXwzlHRpKh5xBcjD6Fq1MeFBN6Y=
Bytes: 4127

On 2025-03-20, bart <bc@freeuk.com> wrote:
> On 20/03/2025 23:18, Keith Thompson wrote:
>> bart <bc@freeuk.com> writes:
>>> On 20/03/2025 19:10, Keith Thompson wrote:
>>>> bart <bc@freeuk.com> writes:
>> [...]
>>>>> stdint.h et al are just ungainly bolt-ons, not fully supported by the
>>>>> language.
>>>> No, they're fully supported by the language.  They've been in the ISO
>>>> standard since 1999.
>>>
>>> I don't think so. They are add-ons that could have been created in
>>> user-code even prior to C99 (user-defined typedefs for 64 bits would
>>> 'need long long').
>> 
>> Sure, they could; see Doug Gwyn's q8, for example.
>
> Isn't that what I said? However I've just looked at this 700-line header:
>
>   https://www.lysator.liu.se/c/q8/stdint.h
>
> Sorry, but there's something wrong if you have to write all that to get 
> a handful of fixed-width types.

That's not all that is needed; the material in Q8defs.h is required
to make the material in the above file work.

It's not just the types, but all the standard-required identifiers.

I feel that this Q8 could probably have been organized a little
differently to make it more compact.

The Q8defs.h header already has conditionals for platforms.
Then Q8's inttypes.h still has to switch on some more abstract
conditions in the preprocessor to select the types.

This two layer business could just be one, more or less.
Q8defs.h could just define, for instance, q8_uintptr_t,
for each platform, and then inttypes just has to expose it under the
standard name:

typedef q8_uintptr_t uintptr_t;

> (And if this is for a multitude of 
> targets, then there should be a dedicated header per target).

What? That would pretty much defeat the whole point of this Q8 library.

What would would select which file to use where?

You drop those files into your C90, and then you have a facsimile
of C99 compatibility, on all the platforms supported by Q8.

> GCC's stdint.h is 200 lines. Mine is 75 lines. It these types were part 

Q8 tries to add the C99 stuff for something like 7 implementations
or implementation familes. GCC is one implementation, but with
many targets.

> of the core language, it would be zero lines.

This kind of argumentation is really not of good quality.

A feature requires lines of code. If those lines are not in some
satellite file like a C header, then they are elsewhere, like in the
compiler source code.

It's not "zero lines" because you hid it in the compiler.

Shoving into a compiler that which can very well live outside of it
isn't even categorically a good idea.

-- 
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca