There seem to be a few ways of representing null-pointers; 0, C's NULL, and nullptr.
Thing is, they always appear to represent 0, and I'm not sure what the usual practice is regarding them. Honestly I'd like to just use a 0 and not worry about it, but is this different on some platforms?
AKA, I prefer to rely on automatic bool type-casting of pointers when writing my loops over a null-ptr terminated list of pointers: for (It it(0); ptList[it]; it++) something(it);
Rather than: for (It it(0); ptList[it] != nullptr; it++) something(it);
But am I making my code platform specific by doing so, or is it a safe assumption the null-ptr is always 0 in binary?
TL;DR How do I write a null-pointer in a standard way?
You are not making your code platform-specific either way. The way to make it platform-specific would have been for (It it(0); reinterpret_cast<uintptr_t>(ptList[it]); it++) something(it);
It's not guaranteed that the object representation of null pointers is zero, but regardless of its representation, the null pointer values will always convert to false and to nullptr, and will always be convertible from integer zero and from nullptr