> Hi all, > > Well, this discussion has been great fun :-\ , but getting back to the > original point...... > > The original poster said that using zero for NULL raised issues on the > MSP430, as there is actually something at zero (at least, I think that > was their intent). However, nobody has yet identified any real problems > this casues. The thing at zero is a register, which one would not > normally access by pointer. Some other registers, like the port > registers, might be accessed by pointer and offset. It has merit there, > since each port has a similar register group. The register at zero isn't > like that, though, and I can't imagine any cause for using a pointer to it. > > Can anyone raise any real issues with NULL being zero? Changing it now > would be a big pain, and would make mspgcc incompatible with a lot of > code produced for other MCU C compilers. > > Regards, > Steve >
There is not normally a problem with using pointers that happen to be NULL in value, unless you are using extra checks for NULL pointers (and is that common on msp430 systems?). So code like "int *p; int x; p = 0; x = *p;" would work perfectly as expected. The only possible problem is then with a function that normally returns a pointer to a register, but might fail and return NULL instead - I can't imagine when that would be a useful function.