Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
Initialize pointers to NULL in Managers.cpp
Michael:
About NULL pointer, I have found the following FAQ, answer, topic and article rather interesting.
Michael
280Z28:
--- Quote from: Michael on December 13, 2005, 02:21:41 pm ---About NULL pointer, I have found the following FAQ, answer, topic and article rather interesting.
Michael
--- End quote ---
I agree that 0 looks like an integer and NULL distinguishes pointer initialization from integer initialization. On that basis alone I will always have state to use NULL for pointers in my style guidelines for any project I create. I'm also a grown up, so if I know that someone else's guidelines specify something different, I will follow them with the same respect I would expect them to treat my rules with if they were helping on my projects.
Michael:
--- Quote from: 280Z28 on December 13, 2005, 04:07:17 pm ---I agree that 0 looks like an integer and NULL distinguishes pointer initialization from integer initialization. On that basis alone I will always have state to use NULL for pointers in my style guidelines for any project I create. I'm also a grown up, so if I know that someone else's guidelines specify something different, I will follow them with the same respect I would expect them to treat my rules with if they were helping on my projects.
--- End quote ---
I used NULL at the beginning as I thought it was better than 0, but switched to 0 when I discovered that it was not. In the project, I am actually working, several partners used 0 instead of NULL. Discussing with them about that was really interesting. However, you should never accept blindly ideas, suggestions, etc. from other persons without first thinking by yourself. This is something, I have learnt.
Michael
rickg22:
Has anyone of you noticed that wxWidgets uses NULL ?
Since C::B is a wxWidgets project, i prefer to follow the convention and use NULL. If anybody thinks of a specific situation where i MUST use 0 instead, please do so.
thomas:
wxWidgets also does stuff like redefining global operator new. Should we do things like that too?
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version