public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jamie Lokier <egcs@tantalophile.demon.co.uk>
To: Ralph Loader <suckfish@ihug.co.nz>
Cc: gcc@gcc.gnu.org
Subject: Re: [Tiny patch] builtin_constant_p improvement.
Date: Fri, 04 Aug 2000 06:13:00 -0000	[thread overview]
Message-ID: <20000804151302.B8999@pcep-jamie.cern.ch> (raw)
In-Reply-To: <14729.54163.779907.515622@sucky.fish>

Just as well, because Glibc assumes this does work.  See strlen,
<bits/string2.h>.

-- Jamie

Ralph Loader wrote:
> The enclosed patch causes the following (recently posted) code to
> return 1 when compiled as C code.  (It already does when compiled as
> C++).  It removes an assumption that pointers can only be constant if
> they are literals.
> 
> inline int f (const char *const s)
> {
>   if (__builtin_constant_p (s))
>     return 1;
>   else 
>     return 0;
> }
> 
> int g ()
> {
>   return f ("abc");
> }

      reply	other threads:[~2000-08-04  6:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-08-03 13:18 Ralph Loader
2000-08-04  6:13 ` Jamie Lokier [this message]

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=20000804151302.B8999@pcep-jamie.cern.ch \
    --to=egcs@tantalophile.demon.co.uk \
    --cc=gcc@gcc.gnu.org \
    --cc=suckfish@ihug.co.nz \
    /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: link
Be 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).