From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32036 invoked by alias); 2 Jan 2007 05:44:44 -0000 Received: (qmail 32028 invoked by uid 22791); 2 Jan 2007 05:44:44 -0000 X-Spam-Check-By: sourceware.org Received: from nile.gnat.com (HELO nile.gnat.com) (205.232.38.5) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 02 Jan 2007 05:44:38 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-nile.gnat.com (Postfix) with ESMTP id A7B9C48CBF4; Tue, 2 Jan 2007 00:44:36 -0500 (EST) Received: from nile.gnat.com ([127.0.0.1]) by localhost (nile.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 10888-01-10; Tue, 2 Jan 2007 00:44:36 -0500 (EST) Received: from takamaka.act-europe.fr (AStDenis-105-1-58-225.w80-8.abo.wanadoo.fr [80.8.155.225]) by nile.gnat.com (Postfix) with ESMTP id B67BC48CBDA; Tue, 2 Jan 2007 00:44:35 -0500 (EST) Received: by takamaka.act-europe.fr (Postfix, from userid 1000) id 1657734C099; Tue, 2 Jan 2007 09:45:23 +0400 (RET) Date: Tue, 02 Jan 2007 05:44:00 -0000 From: Joel Brobecker To: Eli Zaretskii Cc: gdb-patches@sourceware.org Subject: Re: [RFC/RFA] Add support for catch Ada exceptions (take 2) Message-ID: <20070102054523.GF17211@adacore.com> References: <20061231060649.GF25236@adacore.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.2i 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: 2007-01/txt/msg00042.txt.bz2 > > + switch (b->type) > > + { > > + case bp_catch_exception: > > + if (b->addr_string != NULL) > > + { > > + const char *template = _("`%s' Ada exception"); > > + char *msg = alloca (strlen (template) + strlen (b->addr_string)); > > + > > + sprintf (msg, _("`%s' Ada exception"), b->addr_string); > > Why don't you use `template' instead of having two identical strings? That's what I first did, but the compiler complains that he cannot check the string format. Perhaps I could use a macro instead of the plain string, that would reduce a bit the chances of mismatch. This case is very similar to a case discussed recently. Since the strings are very close, the changes of discrepancy are very slim. I prefer this solution over using xsnprintf as suggested by Mark, because we then introduce an arbitrary constant. But it's only a mild preference, however, so let me know if you prefer it like this: char msg[512]; xsnprintf (msg, sizeof (msg), _("`%s' Ada exception"), b->addr_string); -- Joel