LWN.net Logo

access off end of array

access off end of array

Posted Mar 26, 2013 16:04 UTC (Tue) by hummassa (subscriber, #307)
In reply to: access off end of array by khim
Parent article: Regehr: GCC 4.8 Breaks Broken SPEC 2006 Benchmarks

I know for a fact the 6809 microprocessors had some instructions "load/store from pointer with post/pre-auto-increment/decrement" so that one of:

a = *b++
a = *++b
a = *b--
a = *--b
*b++ = a
*++b = a
*b-- = a
*--b = a

was a single instruction; they made easy to implement real fast stacks and queues, and zero-terminated strings (because "a = *b++" &c set the Z flag if the char was zero).


(Log in to post comments)

access off end of array

Posted Mar 26, 2013 16:52 UTC (Tue) by brouhaha (subscriber, #1698) [Link]

Yes, but the 6809 came along much later than the PDP-11, so it's not relevant to discussion of where the C pre/post-increment/decrement operators came from.

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds