Article View: comp.std.c++
Article #1334Re: Non-Portable pointer assignment?
From: Daniel Edelson
Date: Tue, 18 Jun 1991 16:15
Date: Tue, 18 Jun 1991 16:15
38 lines
1665 bytes
1665 bytes
.Article: 2813 of comp.std.c
.From: hansen@pegasus.att.com (Tony L. Hansen)
.Subject: Re: Non-Portable pointer assignment?
.Date: 18 Jun 91 15:04:10 GMT
.
.< From: mcdaniel@adi.com (Tim McDaniel)
.< I would have been quite content to have seen the types and sizes of
.< 'xy' and 'x' differ.
.
.C++ has taken this tack: the type of 'x' is char while the type of 'xy' is
.int. It gives very nice properties when dealing with function and operator
.overloading.
.
. Tony Hansen
. hansen@pegasus.att.com, tony@attmail.com
. att!pegasus!hansen, attmail!tony
Thank you for pointing this out.
This means that the following program is legal in C++ and
ANSI C, and has different meanings in the two languages.
Am I correct in thinking that a design goal of Bjarne's was
to avoid the possibility of such a program?
Is that design goal sufficiently important to motivate x3j16
to change the type of 'c' to int?
#include <stdio.h>
int main(void)
{
printf("%d\n", sizeof('a'));
}
---
Daniel Edelson | ``Recycle your garbage. Please don't
daniel@cis.ucsc.edu, or | make me come and copy after you.''
uunet!ucscc!terra!daniel |
Technical Details
Message-ID:
<17163@darkstar.ucsc.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!agate!darkstar!oak!danielShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!agate!darkstar!oak!daniel From: daniel@cis.ucsc.edu (Daniel Edelson) Newsgroups: comp.std.c++ Subject: Re: Non-Portable pointer assignment? Keywords: 'a' and 'ab' Message-ID: <17163@darkstar.ucsc.edu> Date: 18 Jun 91 16:15:56 GMT Sender: usenet@darkstar.ucsc.edu Organization: UC Santa Cruz Lines: 38