Xref: utzoo comp.lang.c:37711 comp.std.c:4553 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!uupsi!cmcl2!adm!smoke!gwyn From: gwyn@smoke.brl.mil (Doug Gwyn) Newsgroups: comp.lang.c,comp.std.c Subject: Re: increment casted void pointer -- ANSI? Message-ID: <15619@smoke.brl.mil> Date: 28 Mar 91 22:43:40 GMT References: <288@nazgul.UUCP> <15589@smoke.brl.mil> <3492@inews.intel.com> Followup-To: comp.lang.c Organization: U.S. Army Ballistic Research Laboratory, APG, MD. Lines: 24 In article <3492@inews.intel.com> bhoughto@pima.intel.com (Blair P. Houghton) writes: -In article <15589@smoke.brl.mil> gwyn@smoke.brl.mil (Doug Gwyn) writes: ->In article <288@nazgul.UUCP> bright@nazgul.UUCP (Walter Bright) writes: ->-In article <1991Mar8.165300.11692@zoo.toronto.edu> henry@zoo.toronto.edu (Henry Spencer) writes: ->-/There is no way to say "pretend this variable has a different type" in C. ->-The usual to do a 'type paint', which is to change the type of an object ->A strictly conforming method is to use a union type. -Where in the std is it prohibited to fake unions by using a struct -and externally prohibiting attempts to dereference a value -that was superseded by one of a different type? There are constraints on what is strictly conforming use of pointed-to objects, etc. -It seems to say only that a union has to be at least large enough -to hold it's member with the most bits, and to align members -suitably, but not that it has to overlap types. Sure it "overlaps", or acts as if it did. A conforming implementation that, e.g. stores floating-point data in a different address space from integer data may have to jump through hoops if it wishes to make the aliasing of the representations actually work. However, such a program would have to be successfully translated, it just may not work right (in which case the fake pointer business would probably malfunction too).