increment casted void pointer -- ANSI?

Roy Johnson rjohnson at shell.com
Fri Mar 29 03:27:05 AEST 1991


In article <15589 at smoke.brl.mil> gwyn at smoke.brl.mil (Doug Gwyn) writes:
> In article <288 at nazgul.UUCP> bright at nazgul.UUCP (Walter Bright) writes:
> -In article <1991Mar8.165300.11692 at zoo.toronto.edu> henry at zoo.toronto.edu (Henry Spencer) writes:
> -The usual to do a 'type paint', which is to change the type of an object
> -without changing the bit pattern, is to:
> -	*(newtype *)&(object)

> A strictly conforming method is to use a union type.

So can you do

otype object;
newtype feech;

feech = ((union { newtype n; otype o;})object).n;

or

union {
  newtype n;
  otype   o;
} typeunion;

feech = ((union typeunion)object).n;

or do you have to do

union typeunion blah;

blah.o = object;
feech = blah.n;

?

Just what can we get away with, here?
--
======= !{sun,psuvax1,bcm,rice,decwrl,cs.utexas.edu}!shell!rjohnson =======
Feel free to correct me, but don't preface your correction with "BZZT!"
Roy Johnson, Shell Development Company



More information about the Comp.lang.c mailing list