Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: rbowman Newsgroups: comp.os.linux.misc Subject: Re: VMS Date: 28 Jun 2025 06:10:33 GMT Lines: 37 Message-ID: References: <87tt4i9nw5.fsf@eder.anydns.info> <102l0h9$fjtb$5@dont-email.me> <4_GdncCsf-Nqe8n1nZ2dnZfqnPSdnZ2d@giganews.com> <103392c$lpbg$5@dont-email.me> <1033o4a$1qj6$3@dont-email.me> <1033tv1$3aqu$3@dont-email.me> <1034pj8$a74s$1@dont-email.me> <103mndf$57lc$1@dont-email.me> <103n7ve$dqtr$7@dont-email.me> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: individual.net cBUXXw1WOJrkvjAiVRFfiwPzR/TKj1H/T5qo+NV+b6FdwI4zF9 Cancel-Lock: sha1:lSak99IFMJZ3KNY1PpQioLDWSGE= sha256:K36oAhMxgFicLXDlBf17zAtuHm5GVHpSfLIsUwzvi+A= User-Agent: Pan/0.160 (Toresk; ) Xref: csiph.com comp.os.linux.misc:69166 On Sat, 28 Jun 2025 01:13:18 -0400, c186282 wrote: > On 6/27/25 7:03 PM, Lawrence D'Oliveiro wrote: >> On Fri, 27 Jun 2025 18:20:31 -0000 (UTC), Lew Pitcher wrote: >> >>> These last two imply that both unsigned short int and int are at least >>> 16 bits wide. At least, according to the standard. >> >> Or, you know, just rely on the explicit definitions in stdint.h. > > sizeof() will give the right sizes. > > Simple, easy to write, 'best practice'. #include #include int main(void) { printf("sizeof(char) %ld \n", sizeof(char)); printf("sizeof(short) %ld \n", sizeof(short)); printf("sizeof(int) %ld \n", sizeof(int)); printf("sizeof(long) %ld \n", sizeof(long)); return 0; } $ ./sizeof sizeof(char) 1 sizeof(short) 2 sizeof(int) 4 sizeof(long) 8