On Thu, Jul 14, 2011 at 10:40 AM, David Blaikie <[email protected]> wrote: >> Do we really want this to be a warning? > > 5.7/5 allows for well defined behavior when a pointer points to one past the > end of an array, but is not dereferenced (I haven't fully comprehended which > cases are allowed & denied by this change, though - so I'm just stating this > for completeness) & this is often used for iterator pair semantics. > >> >> There are plenty of examples where an out-of-bounds pointer is computed >> for legit reasons. As long as that address is not dereferenced, there isn't >> necessarily a problem. I'm fearful this may generate a fair amount of noise >> on codebases that do elaborate tricks with pointer offsets. Indeed this >> very example doesn't actually exhibit a "bug". > > Indeed even in the examples given, "Foo" + 5, makes a fair amount of sense -
Your math is off-by-one; Foo+4 is legal, Foo+5 is not. -Eli _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
