public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: "Joseph S. Myers" <jsm28@cam.ac.uk> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, Subject: Re: c/4967: GCC should warn about obvious violations of restrict Date: Wed, 21 Nov 2001 21:16:00 -0000 [thread overview] Message-ID: <20011129124603.3252.qmail@sourceware.cygnus.com> (raw) The following reply was made to PR c/4967; it has been noted by GNATS. From: "Joseph S. Myers" <jsm28@cam.ac.uk> To: Andreas Jaeger <aj@suse.de> Cc: <gcc-gnats@gcc.gnu.org>, <ma@suse.de>, <gcc-bugs@gcc.gnu.org> Subject: Re: c/4967: GCC should warn about obvious violations of restrict Date: Thu, 29 Nov 2001 12:40:56 +0000 (GMT) On Thu, 29 Nov 2001, Andreas Jaeger wrote: > The compiler should use the restrict keyword of ISO C99 when invoking > functions and check that the aliasing rules are not violated on the > call side. Why? The keyword provides no information whatsoever to the call side, since the function needn't access the objects pointed to by its arguments at all. > Compile this program - it should give a warning: > int > sprintf_restrict (char *restrict s, const char *restrict t) > { > return *s!=*t; > } > > > > int main (void) > { > char buf[64]; > > sprintf_restrict (buf, buf); > > return 0; > } The program is perfectly valid; while sprintf_restrict could have a const on the target type of its first parameter, there's no need for it to have one. -- Joseph S. Myers jsm28@cam.ac.uk
next reply other threads:[~2001-11-29 12:46 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2001-11-21 21:16 Joseph S. Myers [this message] -- strict thread matches above, loose matches on Subject: below -- 2001-11-21 22:59 aj 2001-11-21 22:57 Andreas Jaeger 2001-11-21 22:56 Joseph S. Myers 2001-11-21 22:49 aj 2001-11-21 21:36 Andreas Jaeger 2001-11-21 21:36 Andreas Jaeger 2001-11-21 21:27 Joseph S. Myers 2001-11-21 21:18 Andreas Jaeger 2001-11-21 21:15 Andreas Jaeger
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20011129124603.3252.qmail@sourceware.cygnus.com \ --to=jsm28@cam.ac.uk \ --cc=gcc-prs@gcc.gnu.org \ --cc=nobody@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).