Article View: comp.std.c
Article #4053Re: Converting between pointer types
From: Christopher R. Volpe
Date: Wed, 20 Sep 1995 00:02
Date: Wed, 20 Sep 1995 00:02
27 lines
1779 bytes
1779 bytes
In article <43n718$ns@Radon.Stanford.EDU>, becker@Xenon.Stanford.EDU (Denizen of the Deep) writes: > >My reading of the standard is that there's no way to convert between >a pointer to a function and a pointer to an object or incomplete >type; i.e. doing so results in undefined behavior. > >My question is this: suppose I am on a machine which has the >same representation for all pointer types and I want to write >code only for this machine (I don't care about portability). > >What is the status of my program if it attempts such a conversion, >given that I know exactly how the compiler is generating code and I know >it does exactly what I want? Is it legal but just not portable, or is >it not even technically a legal C program (since the behavior is >undefined rather than implementation-defined)? The comp.std.c answer is, "It's not legal...period." The behavior is undefined. Anything can happen. However, if, as you say, you know the compiler and you don't care about portability, why are you asking if it's legal? You already know that it works on your implementation, and you've said that that's all you care about. -- Chris Volpe Phone: (518) 387-7766 (Dial Comm 8*833 GE Corporate R&D Fax: (518) 387-6560 PO Box 8, Schenectady, NY 12301 Email: volpecr@crd.ge.com
Technical Details
Message-ID:
<43nllu$8kv@rdsunx.crd.ge.com>Path:
arc1-ca.pugleaf.net!bart.crd.ge.com!volpeReferences:
<43n718$ns@Radon.Stanford.EDU>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!bart.crd.ge.com!volpe From: volpe@bart.crd.ge.com (Christopher R. Volpe) Newsgroups: comp.std.c Subject: Re: Converting between pointer types Date: 20 Sep 1995 00:02:06 GMT Organization: GE Corporate Research & Development Sender: volpe@bart (Christopher R. Volpe) Distribution: world Message-ID: <43nllu$8kv@rdsunx.crd.ge.com> References: <43n718$ns@Radon.Stanford.EDU> Reply-To: volpe@ausable.crd.ge.com NNTP-Posting-Host: bart.crd.ge.com