Path: csiph.com!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Suggested method for returning a string from a C program? Date: Thu, 20 Mar 2025 16:10:33 -0700 Organization: None to speak of Lines: 46 Message-ID: <87iko3s3h2.fsf@nosuchdomain.example.com> References: <868qp1ra5f.fsf@linuxsc.com> <20250319115550.0000676f@yahoo.com> <20250319201903.00005452@yahoo.com> <86r02roqdq.fsf@linuxsc.com> <20250320204642.0000423a@yahoo.com> MIME-Version: 1.0 Content-Type: text/plain Injection-Date: Fri, 21 Mar 2025 00:10:38 +0100 (CET) Injection-Info: dont-email.me; posting-host="279d8aeca4b8e8a9dbe8bc9eae075af5"; logging-data="279745"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+lY0osd3zCwoDTG9/aB1i1" User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:nNqc8g7yddYMppw9VWUGo9A/5OQ= sha1:bV5GbidwNdebJQA/mAkMZg0ulzk= Xref: csiph.com comp.lang.c:391448 bart writes: > On 20/03/2025 18:46, Michael S wrote: >> On Thu, 20 Mar 2025 15:40:20 +0000 >> bart wrote: >>> Pretty much every other open source project I look likes to define >>> their own types! >>> >>> So I have to ask, why do think they do that? >>> >> Most likely mindless parroting of 40 y.o. examples. > > I don't think so. Where such sets of types exist, they tend to be > defined on top of long long too, or even on top of stdint.h types. If they're defined on type of types, it's likely because the definitions were updated (just referring to int32_t is easier than a nest of #ifdefs) while keeping the existing type names and avoiding breaking existing code that depends on them. > Look at this one for example: > > typedef uint8_t byte; // from arduino.h > > I can only one of reason this exists, which is that 'byte' is a far > nicer denotation. I agree in this case. "byte" documents what the type is intended for. It's not uncommon to do something like `typedef unsigned char byte;`, and I've done it myself, but I'm more likely to use `unsigned char` directly and just keep in mind that it is by definition one byte. But "GLuint" doesn't tell me anything that "unsigned int" didn't already tell me. I suspect that exists just because OpenGL (which I haven't looked at lately) defines a number of its own types, and it was more consistent to give them all GL prefixes. > You might also consider why such examples existed even 40 years ago. They existed 40 years ago because didn't exist yet. For that matter, C90 didn't exist yet. (I have some difficulty accepting that 1985 was 40 years ago.) -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com void Void(void) { Void(); } /* The recursive call of the void */