Deutsch   English   Français   Italiano  
<874izntt5t.fsf@nosuchdomain.example.com>

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

Path: news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: Keith Thompson <Keith.S.Thompson+u@gmail.com>
Newsgroups: comp.lang.c
Subject: Re: Suggested method for returning a string from a C program?
Date: Thu, 20 Mar 2025 12:10:22 -0700
Organization: None to speak of
Lines: 37
Message-ID: <874izntt5t.fsf@nosuchdomain.example.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>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Date: Thu, 20 Mar 2025 20:10:23 +0100 (CET)
Injection-Info: dont-email.me; posting-host="2f20008cbcfa55ae60494be276e0bfaa";
	logging-data="4043012"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19ymM3mW1OLB6OAhXmRjLFy"
User-Agent: Gnus/5.13 (Gnus v5.13)
Cancel-Lock: sha1:0TTZt2O97lN8rrCi9UBwGG81fvY=
	sha1:VfslyXO3mSuYQEOfDzj0G7pnStQ=

bart <bc@freeuk.com> writes:
[...]
> This is why it popular to just do:
>
>   typedef long long int i64;
>
> and to use %lld to print, and -LL on literals to force a 64-bit type.

Is it?  I don't recall seeing anyone other than you do that.

> 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.

> The problem with 'long' manifests itself there too, since on Linux,
> 'int64_t' appears to be commonly defined on top of 'long' for 32-bit
> systems, and 'long long' for 64-bit ones.

If you're writing code for which that's a problem, you probably need to
fix your code.

> So somebody eschewing those ugly macros and using "%ld" to print an
> 'int64_t' type, will find it doesn't work when run on a 64-bit system,
> where "%lld" is needed. Same problem with using '1L' to define an
> int64_t literal.

Somebody writing blatantly non-portable code will run into problems when
they try to port it.

I understand that you dislike <stdint.h>.  That's both perfectly
acceptable and not very interesting.

-- 
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */