-/// delete pointer if it is not NULL
-#define DELETEP(p) if ( (p) != NULL ) delete (p)
-/// delete array pointer if it is not NULL
-#define DELETEA(p) if ( (p) != NULL ) delete [] (p)
+/// delete pointer if it is not NULL and NULL it afterwards
+// (checking that it's !NULL before passing it to delete is just a
+// a question of style, because delete will do it itself anyhow, but it might
+// be considered as an error by some overzealous debugging implementations of
+// the library, so we do it ourselves)
+#if defined(__SGI_CC__)
+// Okay this is bad styling, but the native SGI compiler is very picky, it
+// wont let you compare/assign between a NULL (void *) and another pointer
+// type. To be really clean we'd need to pass in another argument, the type
+// of p.
+// Also note the use of 0L, this would allow future possible 64bit support
+// (as yet untested) by ensuring that we zero all the bits in a pointer
+// (which is always the same length as a long (at least with the LP64 standard)
+// --- offer aug 98
+#define wxDELETE(p) if ( (p) ) { delete (p); p = 0L; }
+#else
+#define wxDELETE(p) if ( (p) != NULL ) { delete p; p = NULL; }
+#endif /* __SGI__CC__ */
+
+// delete an array and NULL it (see comments above)
+#if defined(__SGI_CC__)
+// see above comment.
+#define wxDELETEA(p) if ( (p) ) { delete [] (p); p = 0L; }
+#else
+#define wxDELETEA(p) if ( ((void *) (p)) != NULL ) { delete [] p; p = NULL; }
+#endif /* __SGI__CC__ */