Andreas Schwab wrote:
> > This would certainly be a departure from historical practice.
> 
> Implementations are free to define undefined behaviour any way they
> like.  The C standard imposes no restrictions on that behaviour.

The question is whether glibc wants to make programs crash, that have
been working fine for decades on all platforms.

For no reason other than standards-pickiness. It's not even a matter of
speed, because this behaviour implies an additional conditional branch
instruction that tests for a NULL pointer. (glibc certainly does not
make the mistake of accessing ptr[0] when n = 0, this would be wrong
also when ptr is pointing to an I/O mapped address range, and would cause
unnecessary L1 cache operations when ptr is pointing to regular memory.)

Bruno


_______________________________________________
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to