Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: gdb-patches@sourceware.org
Subject: Re: [RFC] Strings and arrays without malloc
Date: Fri, 21 Mar 2008 15:03:00 -0000	[thread overview]
Message-ID: <20080321150238.GE25307@caradoc.them.org> (raw)
In-Reply-To: <20080313192157.GJ3738@adacore.com>

On Thu, Mar 13, 2008 at 12:21:57PM -0700, Joel Brobecker wrote:
> > Here's some expressions which used to call malloc and still do; these
> > are operations which involve pointers, so we need to call malloc to
> > get a valid pointer for them.
> > 
> >   print *"abc"
> >   print "abc" + 1
> >   print &"abc"
> >   print strcmp ("abc", "def")
> >   print &{4, 5, 6}
> 
> Honestly, except maybe for the case where strcmp is involved, I find
> that the semantics of the expressions could be debated.

I agree.  I seriously considered breaking some more of these to remove
one of the coercions.  But strcmp ("abc", "def") obviously has to
work; I don't remember which ones I was considering breaking now.

> Or, in one expression (if I get my precedence right):
> 
>     print &(*&{4, 5, 6})[1]

Right.  But I'm not going out of my way to document this, because to
be honest I can't think of a single reason to do it.

Patch checked in!

-- 
Daniel Jacobowitz
CodeSourcery


      reply	other threads:[~2008-03-21 15:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-09 16:14 Daniel Jacobowitz
2008-03-09 22:20 ` Eli Zaretskii
2008-03-11  6:58 ` Tom Tromey
2008-03-13  6:12   ` Tom Tromey
2008-03-13 14:16     ` Thiago Jung Bauermann
2008-03-13 14:54       ` Tom Tromey
2008-03-13 16:22         ` Thiago Jung Bauermann
2008-03-13 16:59           ` Tom Tromey
2008-03-13 20:47             ` Tom Tromey
2008-03-13 19:22 ` Joel Brobecker
2008-03-21 15:03   ` Daniel Jacobowitz [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=20080321150238.GE25307@caradoc.them.org \
    --to=drow@false.org \
    --cc=gdb-patches@sourceware.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: 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