Hacker News new | past | comments | ask | show | jobs | submit login

You mean like this?

#define NULL __DARWIN_NULL

...

#define __DARWIN_NULL ((void *)0)




Something like that. It makes the following invalid in C++ but valid in C:

  int *ptr = NULL;


Except for the fact that the real definition is actually more like:

    #ifdef __cplusplus
    #define __DARWIN_NULL __null
    #else /* ! __cplusplus */
    #define __DARWIN_NULL ((void *)0)
    #endif /* __cplusplus */
So the code you mentioned works just fine in C++.


Except that the actual compiler I was using was for the PlayStation 2, so I very much doubt it had that precise code you just outlined, and it really did have NULL defined as ((void* )0), and it really did break. I saw it happen.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: