Just my 2 pesos. When CPUs are 10% faster, would this little optimization matter?
A typical CPU traps invalid derefs by segfaulting the process, but the CPU itself doesn't explode. I do see Dan's point, but I also predoct people gravitating towards the "safe" interpreter because of that extra fuzzy. -Melvin Smith IBM :: Atlanta Innovation Center [EMAIL PROTECTED] :: 770-835-6984 Dan Sugalski <[EMAIL PROTECTED]> To: Alex Gough <[EMAIL PROTECTED]>, Simon Glover <[EMAIL PROTECTED]> 03/12/2002 09:32 cc: Simon Cozens <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> AM Subject: Re: [[EMAIL PROTECTED]: [netlabs #423] Fwd: Parrot segfaults on substr] At 1:24 AM +0000 3/12/02, Alex Gough wrote: >On Mon, 11 Mar 2002, Simon Glover wrote: > >> >> For more fun in the same vein, try this: >> >> length S0 >> end >> >> In both cases the problem is that we're not checking the STRING* > > pointer passed to the function before we start trying to dereference it. > >I seem to remember someone unpatching a couple of if (NULL == string) >statements recently. I'll be blunt and say: DON'T DO THAT. Defensive >programming is good, segfaulting is bad, remember? There's no checking on purpose. We're assuming that the interpreter's internal state is consistent, and that the code compilers emit is correct. The Safe-mode interpreter can and will check both S and P registers for correctness in the opcode functions, but the base interpreter can skip it. -- Dan --------------------------------------"it's like this"------------------- Dan Sugalski even samurai [EMAIL PROTECTED] have teddy bears and even teddy bears get drunk