From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26006 invoked by alias); 21 Mar 2008 15:03:00 -0000 Received: (qmail 25997 invoked by uid 22791); 21 Mar 2008 15:03:00 -0000 X-Spam-Check-By: sourceware.org Received: from NaN.false.org (HELO nan.false.org) (208.75.86.248) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 21 Mar 2008 15:02:40 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id 0FEF598298 for ; Fri, 21 Mar 2008 15:02:39 +0000 (GMT) Received: from caradoc.them.org (22.svnf5.xdsl.nauticom.net [209.195.183.55]) by nan.false.org (Postfix) with ESMTP id E240398278 for ; Fri, 21 Mar 2008 15:02:38 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.69) (envelope-from ) id 1JcilS-0006WY-3k for gdb-patches@sourceware.org; Fri, 21 Mar 2008 11:02:38 -0400 Date: Fri, 21 Mar 2008 15:03:00 -0000 From: Daniel Jacobowitz To: gdb-patches@sourceware.org Subject: Re: [RFC] Strings and arrays without malloc Message-ID: <20080321150238.GE25307@caradoc.them.org> Mail-Followup-To: gdb-patches@sourceware.org References: <20080309161335.GA26917@caradoc.them.org> <20080313192157.GJ3738@adacore.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20080313192157.GJ3738@adacore.com> User-Agent: Mutt/1.5.17 (2007-12-11) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-03/txt/msg00303.txt.bz2 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