Re: [perl #43105] [PATCH] function mmd.c::mmd_expand_y: newly allocated memory unitialized On Sun, Jun 03, 2007 at 08:00:18AM -0700, Bernhard Schmalhofer via RT wrote:

> I have looked at the 'more_memory.patch' and I'm wondering about the
> portability.
> In that patch loops where pointers are explicitly set to NULL
> are replaced with a  
>   memset( start, 0, len);
> 
> What happens when NULL is not a consective series of '\\0' chars?

I think that it breaks.

> Are there such platforms and are they releavant for parrot?

I believe that this assumption is endemic in Perl 5, and it's never hindered
Perl 5's portability. The C FAQ gives examples of platforms where NULL is not
all bits zero - http://c-faq.com/null/machexamp.html - and I've never
encountered anyone using them.

(As an aside, I think that Perl 5 also (mostly?) doesn't assume 2s complement
storage of integers. IIRC a bug report from a Ahmdal mainframes gave the
impression that it was using sign and magnitude. However, we've not heard
about anyone using Ahmdal mainframes in years. Likewise no-one has missed the
removal of memory model support from Configure, so presumably no-one is
compiling on a PDP-11 anymore. We did discover nasal daemons, or something
similarly painful, on Irix64, until we removed assumptions about signed
integer overflow. (It's undefined behaviour. It will bite))

Nicholas Clark

