Deutsch   English   Français   Italiano  
<vrh9fu$3eg1e$1@dont-email.me>

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

Path: news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: Muttley@DastardlyHQ.org
Newsgroups: comp.lang.c
Subject: Re: Suggested method for returning a string from a C program?
Date: Thu, 20 Mar 2025 14:42:06 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 30
Message-ID: <vrh9fu$3eg1e$1@dont-email.me>
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>
Injection-Date: Thu, 20 Mar 2025 15:42:07 +0100 (CET)
Injection-Info: dont-email.me; posting-host="bf6e2baa5b47e6eff27d97030a12465c";
	logging-data="3620910"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/s1r3lXVC5QZzC6qalpG9e"
Cancel-Lock: sha1:0SXP0qthI48qPmhuBTeVVo0k0BI=

On Thu, 20 Mar 2025 13:36:43 GMT
scott@slp53.sl.home (Scott Lurndal) wibbled:
>bart <bc@freeuk.com> writes:
>>On 20/03/2025 12:09, Tim Rentsch wrote:
>>> Michael S <already5chosen@yahoo.com> writes:
>>
>>>> I suspected that, but was not sure, so suggested to DFS a type that I am
>>>> sure about.
>>> 
>>> The width of  char and [un]signed char   must be at least  8 bits.
>>> The width of          [un]signed short   must be at least 16 bits.
>>> The width of            [un]signed int   must be at least 16 bits.
>>> The width of           [un]signed long   must be at least 32 bits.
>>> The width of      [un]signed long long   must be at least 64 bits.
>>> 
>>> That should be easy enough to remember now.
>>
>>That table suggests that any program mixing 'short' and 'int' is 
>>suspect. If 'int' doesn't need to store values beyond 16 bits, then why 
>>not use 'short'?
>>
>>'long' is another troublesome one. If the need is for 32-bit values, 
>>then it's surprisingly rare in source code.
>
>Long is useless, because Microsoft made the mistake of defining
>'long' as 32-bits on 64-bit architectures, while unix and linux

Probably for backwards compatibility with 32 bit code that did bit twiddling 
with longs.