Some subsurface notes from a week of diving

Thiago Macieira thiago at macieira.org
Mon Mar 17 14:47:01 PDT 2014


Em seg 17 mar 2014, às 12:33:51, Linus Torvalds escreveu:
> > struct D { int i; int j; };
> > int f(struct D *d)
> > {
> >
> >         int *p = &d->j;
> >         if (!p)
> >                 return -1;
> >         return *p;
> >
> > }
> > 
> > Clang 3.4 removes the check for !p. ICC 14.0 and GCC 4.9 don't.
> 
> Yes, and I agree with Clang for this case.
> 
> But if you change that thing to tests "d" for NULL, and Clang removes
> the test, then I think Clang is buggy. I don't have clang installed..

None of the compilers I have installed remove the check for if (!d), which was 
the original discussion.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358



More information about the subsurface mailing list