Common malloc/free practice violates ANSI standard ?

Wm E Davidsen Jr davidsen at crdos1.crd.ge.COM
Tue Oct 17 05:51:33 AEST 1989


In article <7366 at thor.acc.stolaf.edu>, mike at thor.acc.stolaf.edu (Mike Haertel) writes:
|  In article <1989Oct14.043811.669 at anucsd.oz> bdm at anucsd.oz (Brendan McKay) writes:
|  >* assigning a void* to an OBJ* involves rounding up to an even address
|  
|  The standard doesn't say anything about "rounding" pointers.

	[  exactly so, it doesn't say *anything* about it  ]

|  Assigning a misaligned void* to an OBJ* might well cause a trap when
|  the OBJ* is dereferenced.  Or even when the void* is just assigned to it!

  You're right, of course, but the standard doesn't forbid performing an
allignment on a pointer assign, does it? I don't have a copy here, but I
think we discussed this when someone said the standard *required*
alligning the pointer.

  Just because no sane person would do something doesn't mean it's forbidden.
-- 
bill davidsen	(davidsen at crdos1.crd.GE.COM -or- uunet!crdgw1!crdos1!davidsen)
"The world is filled with fools. They blindly follow their so-called
'reason' in the face of the church and common sense. Any fool can see
that the world is flat!" - anon



More information about the Comp.std.c mailing list