Article View: comp.std.c
Article #3722Re: 'sizeof e' vs. 'sizeof (T)' (was: Re: Parenthesis with return ?)
From: Tanmoy Bhattacharya
Date: Mon, 14 Aug 1995 16:10
Date: Mon, 14 Aug 1995 16:10
30 lines
1719 bytes
1719 bytes
In article <40nqhd$1rs4@usenetp1.news.prodigy.com>, NGMV85A@prodigy.com (Paul Long) writes: |> clive@stdc.demon.co.uk (Clive D.W. Feather) wrote: <snip> |> >> sizeof c + 1 |> > |> >The last of these can never be 1 (assuming it occurs in a strictly |> >conforming program). |> |> Sure it would. The usual arithmetic promotions would cause "c" to be And explains why `sizeof (c + 1)' can be 1... I just noticed that most beginners' text probably would have trouble explaining the following (implementation-specific) results on basis of `precedence' alone (At least, I had never come across such concepts before I started using C: and _I_ still wouldn't call it precedence.) sizeof + (char) 1 == 4 sizeof (char) + 1 == 2 Cheers Tanmoy -- tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242) Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87544-0285,USA H:#3,802,9 St,NM87545 Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>, <http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/ internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html> fax: 1 (505) 665 3003 voice: 1 (505) 665 4733 [ Home: 1 (505) 662 5596 ]
Technical Details
Message-ID:
<40nshm$2i1@newshost.lanl.gov>Path:
arc1-ca.pugleaf.net!qcd.lanl.gov!tanmoyReferences:
<3415076830.8283127@ortel.org> <dd9uho.ajm@stdc.demon.co.uk> <40nqhd$1rs4@usenetp1.news.prodigy.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!qcd.lanl.gov!tanmoy From: tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya) Newsgroups: comp.std.c Subject: Re: 'sizeof e' vs. 'sizeof (T)' (was: Re: Parenthesis with return ?) Date: 14 Aug 1995 16:10:30 GMT Organization: Los Alamos National Laboratory Distribution: world Message-ID: <40nshm$2i1@newshost.lanl.gov> References: <3415076830.8283127@ortel.org> <dd9uho.ajm@stdc.demon.co.uk> <40nqhd$1rs4@usenetp1.news.prodigy.com> NNTP-Posting-Host: qcd.lanl.gov