This is the mail archive of the gcc@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: restrict keyword [was: expalin this syntax pls]


On Fri, 18 Oct 2002, Joe Buck wrote:

> This means that we can't issue a hard error for it, but a warning may well
> still be appropriate.  Errors are for code that is wrong, warnings are for
> code that is likely to be wrong. If you insist on not issuing warnings for
> such code, we have the problem that we can't use similar mechanisms to
> warn about possible misuse of memcpy, whose specification implies
> "restrict" even for C++, which doesn't have the keyword.

You can't issue a hard error for it anyway, since the code might never be 
executed.  The key questions for issuing a warning (under its own option, 
possibly included in -Wall) are:

* Does anyone write real (broken) code the warning would detect?  (The 
relevant question for having the warning at all.)
* Does anyone write real (working) code the warning would wrongly trigger 
on?
* How common are these?
* Can working code wrongly triggering the warning be easily changed, even 
if automatically generated, so as not to trigger it?  (The relevant 
question for -Wall inclusion.)

In the case of memcpy, we have more information to tell whether a call
*is* a problem (rather than might be).

-- 
Joseph S. Myers
jsm28@cam.ac.uk


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