[Development] Qt 5.2 header diff: QtXmlPatterns

Nicolás Alvarez nicolas.alvarez at gmail.com
Tue Nov 5 18:00:02 CET 2013


2013/11/5 Marc Mutz <marc.mutz at kdab.com>:
> 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



More information about the Development mailing list