This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] cilkplus array notation for C (clean, independent patchset, take 1)


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
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]