[sdiy] Programming Language Recommendation

mskala at ansuz.sooke.bc.ca mskala at ansuz.sooke.bc.ca
Thu Dec 10 00:12:11 CET 2020

On Wed, 9 Dec 2020, KA4HJH wrote:
> That sort of reminds me of a friend of mine who was using a CPU (and
> compiler) whose NULL address was 0x80000000.
> Caused no end of trouble when porting code from programmers who
> instead of comparing a pointer with NULL just checked it against
> zero...
> I.e. they did this:
> if (my_pointer) address_is_valid();
> Instead of:
> if (my_pointer != NULL) address_is_valid();

Well, it's part of the specification for C that when pointers are
converted to integers (as they will be implictly, when used as if
conditions), NULL has to convert to zero even if the bit pattern for NULL
is not actually an all-zeroes word.  So the C compiler that makes that
construction break is not a conformant compiler.

Matthew Skala
mskala at ansuz.sooke.bc.ca                 People before tribes.

More information about the Synth-diy mailing list