diff --git a/src/xmlpatterns/api/qabstractxmlnodemodel.h b/src/xmlpatterns/api/qabstractxmlnodemodel.h
index 0bdf9c4f8b1e2876eccf27347293fecd94df74bd..98148f713df44a71fe79b98777ed8298cc9694ac 100644
--- a/src/xmlpatterns/api/qabstractxmlnodemodel.h
+++ b/src/xmlpatterns/api/qabstractxmlnodemodel.h
@@ -92,10 +92,10 @@ namespace QPatternist
         };
         void *pointer() const
         {
-            /* Constructing to qptrdiff means we avoid the warning "cast to pointer
-             * from integer of different size."
+            /* Constructing to qptrdiff means we avoid warnings.
              */
-            return (void *)qptrdiff(data);
+            char *null = 0;
+            return null + qptrdiff(data);
         }
 
         Data additionalData;