Article View: comp.lang.c.moderated
Article #2635Re: pointer casting
From: Dan Pop
Date: Sun, 21 Apr 1996 17:11
Date: Sun, 21 Apr 1996 17:11
24 lines
1391 bytes
1391 bytes
In <4lbao2$lkd@solutions.solon.com> Network News <news@dcs.warwick.ac.uk> writes: >Are conversions of pointers without the proper alignment actually >illegal, i.e. invoking undefined behaviour? All arbitrary pointer conversions are illegal, unless the standard explicitly states otherwise. The result of such a conversion is undefined behaviour, indeed. >It seems to me that an >implementation where conversion of an unaligned byte pointer to a word >pointer will trap ought to be conforming. On most real world platforms, the trap occurs when the resulting pointer is dereferenced. But an implementation where the trap occurs at conversion time would be conforming (when it comes to undefined behaviour, any behaviour is conforming). Dan -- Dan Pop CERN, CN Division Email: danpop@mail.cern.ch Mail: CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland
Technical Details
Message-ID:
<4ldq75$5fi@solutions.solon.com>Path:
arc1-ca.pugleaf.net!solon.com!not-for-mailReferences:
<4l33mf$7pr@solutions.solon.com> <4lbao2$lkd@solutions.solon.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail From: danpop@mail.cern.ch (Dan Pop) Newsgroups: comp.lang.c.moderated Subject: Re: pointer casting Date: 21 Apr 1996 12:11:01 -0500 Organization: CERN European Lab for Particle Physics Sender: clc@solutions.solon.com Approved: clc@solutions.solon.com Message-ID: <4ldq75$5fi@solutions.solon.com> References: <4l33mf$7pr@solutions.solon.com> <4lbao2$lkd@solutions.solon.com> NNTP-Posting-Host: solutions.solon.com X-Newsreader: NN version 6.5.0 #18 (NOV)