Skip to main content
6 events
when toggle format what by license comment
Apr 7, 2014 at 21:34 comment added Corbin I have to disagree with 0 over NULL. NULL conveys meaning that 0 doesn't. Though the same as 0, NULL still mentally screams "hey this is a pointer!" I tend to agree that macros are evil, but I think NULL is an exception. T* ptr = 0; just doesn't have the same mental effect on me that T* ptr = NULL; does. Not to mention that compilers are still allowed to generate notices about NULL. A compiler can still have internal special meaning for NULL and treat it like it's a pointer type just in warning form instead of an error.
Apr 3, 2014 at 3:50 comment added Corey +1 for the suggestion to push/pop at the start of the list rather than the end. For large stacks this is a major speed improvement.
Apr 2, 2014 at 21:57 comment added ChrisW @200_success Apparently the standard now does #define NULL 0 ... so NULL is the same as 0 ... but NULL is a (unnecessary/useless) C-style macro ... see e.g. stroustrup.com/bs_faq2.html#null ... Perhaps NULL used to cause problems years ago when a "C/C++" compiler defined it as #define NULL (void*)0 and so NULL couldn't be assigned to e.g. a variable of type char*.
Apr 2, 2014 at 21:34 comment added 200_success I know nullptr is the new preferred null pointer, but why is 0 better than NULL?
Apr 2, 2014 at 21:00 history edited ChrisW CC BY-SA 3.0
whitespace
Apr 2, 2014 at 14:41 history answered ChrisW CC BY-SA 3.0