This is the mail archive of the
mailing list for the GCC project.
Re: [patch] cilkplus array notation for C (clean, independent patchset, take 1)
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Aldy Hernandez <aldyh at redhat dot com>
- Cc: "Iyer, Balaji V" <balaji dot v dot iyer at intel dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 26 Mar 2013 17:04:42 +0000
- Subject: Re: [patch] cilkplus array notation for C (clean, independent patchset, take 1)
- References: <5149D62F dot 9070503 at redhat dot com> <Pine dot LNX dot 4 dot 64 dot 1303211447220 dot 9992 at digraph dot polyomino dot org dot uk> <BF230D13CA30DD48930C31D40993300016D7DBBE at FMSMSX102 dot amr dot corp dot intel dot com> <51507F31 dot 1080003 at redhat dot com>
On Mon, 25 Mar 2013, Aldy Hernandez wrote:
> > I always tend to check for a null pointer before I access the fields in the
> > structure. In this case it is unnecessary. In some cases (e.g. find_rank)
> > there is a good chance a null pointer will be passed into the function and
> > we need to check that and reject those.
> I think what Joseph is suggesting is that if NULL is not valid, then the
> caller should check this. But if NULL is valid, then it should be documented
> in the function comment at the top.
The caller should only check it if it's valid in the caller but not the
callee. If it's invalid in the caller as well, neither should check
(except maybe in an assertion if felt appropriate in a particular case).
Joseph S. Myers