r203665 - Use vector<T>::data() to simplify code

Arthur O'Dwyer arthur.j.odwyer at gmail.com
Wed Mar 12 10:32:17 PDT 2014


On Wed, Mar 12, 2014 at 10:17 AM, Jonathan 'Rynn' Sauer
<jonathan.sauer at gmx.de> wrote:
> Hello,
>
>> +      Args->data(), Args->data() + Args->size(), Diags,
>
> Isn't that identical to
>
>   &*Args->begin(), &*Args->end()

The old code's organization implied that if Args is empty, then any
variation on &Args[0], *Args->begin(), etc. has undefined behavior.
Certainly *Args->begin() does not identify an object. I don't know
enough C++ to tell you whether &*Args->begin() is necessarily legal or
not.

–Arthur




More information about the cfe-commits mailing list