On Wed, Apr 22, 2015 at 4:14 PM, Garrick Peterson <[email protected]> wrote: [...] >> for (cp = dc.col; cp < &dc.col[LEN(dc.col)]; ++cp) > > Forgive my ignorance of the LEN macro, but doesn’t this rely on accessing a > memory address outside of the allocated array? Wouldn’t that cause problems > if you’re up against memory boundaries? I would personally write it as either > for (cp = dc.col; cp <= &dc.col[LEN(dc.col)-1]; ++cp) > or even better > for (cp = dc.col; cp - dc.col < LEN(dc.col); ++cp) >
The only way to obtain the "upper end" pointer that cp is compared to is to evaluate dc.col + sizeof(dc.col). No dereference of the value that address holds is required. cheers! mar77i
