[Development] Qt 5.2 header diff: QtXmlPatterns

Marc Mutz marc.mutz at kdab.com
Tue Nov 5 12:24:32 CET 2013


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?

What's wrong with

   reinterpret_cast<void*>(qptrdiff(data));

Or simply

  return ptr;

which forms a union with `data`?



More information about the Development mailing list