[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: dpkg with triggers support (again)

Ian Jackson <ian@davenant.greenend.org.uk> writes:

> I don't know if there are any plausible machines out there where int*'s
> and char*'s have different representations but in fact just the other
> day I was having a conversation about how on certain weird ARMish chips
> (where pointers address words, not bytes) that would be one reasonable
> ABI given the architecture.

If a (char *)0 doesn't work as a pointer argument that's expecting
(int *)0, then calloc or memset of a structure with pointer members
probably won't reliably give you null pointers.  The amount of code that
depends on that behavior is *significant*.  It's fairly rare to see UNIX
code that doesn't make that assumption.

The only possible exception is if (char *)0 and (int *)0 both use all-zero
bit patterns but are different sizes.  I've never heard of an architecture
that did that.  (I *have* heard of architectures in common use where a
pointer to data is a different size than a pointer to a function, but
function pointers are very rarely passed to variadic functions.)

Russ Allbery (rra@debian.org)               <http://www.eyrie.org/~eagle/>

Reply to: