🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #3711

Re: 'sizeof e' vs. 'sizeof (T)' (was: Re: Parenthesis with return ?)

#3711
From: Paul Long
Date: Sat, 12 Aug 1995 16:44
21 lines
1107 bytes
In article 1995Aug11.091041@lglsun.epfl.ch, wolf@lglsun.epfl.ch (Thomas Wolf)
writes:
>Due to integral promotion of the char c, the "sizeof (c + 1)" in your
example
>does *not* yield 1. It is equivalent to "sizeof (int)".

"sizeof(int)" could yield 1. It depends on how large an implementation
chooses to make a "byte" and an int.  IOW, a byte ain't necessarilly 8 bits
long (CHAR_BIT >= 8). If a byte (and therefore also a char) were 16 bits
long, and an int were also 16 bits long, which could satisfy the limits
constraints, the following would all yield 1:

   sizeof(char)
   sizeof(int)
   sizeof c
   sizeof c + 1

Admittedly, most implementations choose to make a "byte" 8 bits long, but
there are some who do not.

Paul_Long@ortel.org
Technical Details
Message-ID: <3415076830.8283127@ortel.org>
Path: arc1-ca.pugleaf.net!uucp3.netcom.com!otsrvr!Paul_Long

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!uucp3.netcom.com!otsrvr!Paul_Long
From: Paul_Long@ortel.org (Paul Long)
Reply-To: Paul_Long@ortel.org
Newsgroups: comp.std.c
Distribution: world
Subject: Re: 'sizeof e' vs. 'sizeof (T)' (was: Re: Parenthesis with return ?)
Date: 12 Aug 1995 16:44:45 GMT
Message-ID: <3415076830.8283127@ortel.org>
Organization: Oregon Telcom