On 2017-02-22 00:46:31, Bruce Evans wrote:
On Mon, 20 Feb 2017, Conrad Meyer wrote:
Maybe this is moot.  I don't believe any architecture FreeBSD actually
supports has non-zero bitpattern NULL, but something weird like CHERI
might.

Compilers should do portability checks on it.  In fact, the convolutions
in this file do little except define nullptr and __null to let compilers
do more checking.  Only the C++ case even has them.  Compilers can do
most checks using just the C90 definition of null pointer constants.

tcc(1) of the TenDRA project can set the null pointer representation to
0x55555555 via -f option of trans(1) (but only on x86):

$ cat test.c
#include <stdio.h>
int main(void)
{
        char *x = NULL;
        unsigned long int y = (unsigned long int)x;
        printf("%lx\n", y);
        return 0;
}

$ tcc ./test.c -o test
$ ./test
0
$ tcc -Wt,f ./test.c -o test
$ ./test
55555555

See http://www.tendra.org/trans.1/ for more details.

Attachment: signature.asc
Description: PGP signature

Reply via email to