From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13718 invoked by alias); 3 Sep 2010 09:38:15 -0000 Received: (qmail 13708 invoked by uid 22791); 3 Sep 2010 09:38:14 -0000 X-SWARE-Spam-Status: No, hits=-0.5 required=5.0 tests=AWL,BAYES_00,MISSING_HEADERS,TW_BF,TW_XB,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from isis.lip6.fr (HELO isis.lip6.fr) (132.227.60.2) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 03 Sep 2010 09:37:43 +0000 Received: from mailone.lip6.fr (mailone.desir.lip6.fr [132.227.205.6]) by isis.lip6.fr (8.14.4/lip6) with ESMTP id o839banL002161 for ; Fri, 3 Sep 2010 11:37:36 +0200 (CEST) X-pt: isis.lip6.fr Received: from [132.227.203.140] (myre.desir.lip6.fr [132.227.203.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mailone.lip6.fr (Postfix) with ESMTPSA id 2451F86 for ; Fri, 3 Sep 2010 11:37:36 +0200 (CEST) Message-ID: <4C80C1E8.3030202@lip6.fr> Date: Fri, 03 Sep 2010 09:38:00 -0000 From: Nicolas Sabouret User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.11) Gecko/20100713 Thunderbird/3.0.6 MIME-Version: 1.0 CC: gdb@sourceware.org Subject: Re: printing array in function References: <4C80BA7A.3030309@lip6.fr> <20100903091554.GA17610@host1.dyn.jankratochvil.net> In-Reply-To: <20100903091554.GA17610@host1.dyn.jankratochvil.net> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2010-09/txt/msg00011.txt.bz2 Dear Jan, Le 03/09/2010 11:15, Jan Kratochvil a écrit : > On Fri, 03 Sep 2010 11:06:02 +0200, Nicolas Sabouret wrote: >> 1: void f(int tab[]) { >> 2: tab[0] = 1; >> 3: } >> (gdb) p tab -> (int *) 0xbffff440 > > I have only an idea by C++: > > void f(int (&tab)[2]) { > (gdb) p tab > $1 = (int (&)[2]) @0x7fffffffde50: {-1, -1} Thanks for the quick answer. However, your solution requires : 1) to fix the array size in the function signature (this is something we would prefer to avoid but why not) 2) to use a non-regular syntax in the function signature, which is someting we cannot do (we want our students to lear the proper C-syntax). Any other idea ? -- Nicolas Sabouret LIP6, BC169, 4 place Jussieu, 75005 Paris http://www-poleia.lip6.fr/~sabouret