----- Original Message ----- > From: "Marshall Clow via cfe-commits" <cfe-commits@lists.llvm.org> > To: "mclow lists" <mclow.li...@gmail.com>, chandl...@gmail.com, > rich...@metafoo.co.uk, e...@efcs.ca > Cc: jo...@netbsd.org, cfe-commits@lists.llvm.org > Sent: Tuesday, August 11, 2015 3:30:10 PM > Subject: Re: [PATCH] D11948: Add some macros to abstract marking of > parameters as "not null", and use them in > <cstring> > > mclow.lists added a comment. > > In http://reviews.llvm.org/D11948#221991, @joerg wrote: > > > No, it doesn't. It tells the compiler that it is free to make such > > assumptions. > > > Again, I disagree. The compiler already knows it is free to make such > assumptions. > (LLVM has an entire optimizer pass devoted to `memcpy` and friends)
I agree with Marshall. This ship has already sailed - the standard says what is says, and GCC and other compilers already take advantage of it, and thus portable code already cannot depend on the behavior of passing null pointers. Even non-portable code will be locked to specific compiler/library versions (which is already true with GCC) because, annotations aside, compilers are free to assume the standard semantics regardless. The annotations at least give users some more information on what the compiler is assuming, and so having them is better than not. -Hal > > > http://reviews.llvm.org/D11948 > > > > _______________________________________________ > cfe-commits mailing list > cfe-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits > -- Hal Finkel Assistant Computational Scientist Leadership Computing Facility Argonne National Laboratory _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits