2013/11/5 Marc Mutz <[email protected]>:
> On Tuesday, November 05, 2013 01:07:32 Thiago Macieira wrote:
>> -            return (void *)qptrdiff(data);
>> +            char *null = 0;
>> +            return null + qptrdiff(data);
>
> Since this is equivalent to
>
>     return 0[qptrdiff(data)];
>
> isn't that dereferencing the nullptr and therefore undefined behaviour?

I don't think that's the case. a[b] is equivalent to *(a+b), not
(a+b). Thus, 0[qptrdiff(data)] would be equivalent to *(null +
qptrdiff(data)), but that's not what the diff says,

-- 
Nicolás
_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to