From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19148 invoked by alias); 5 Sep 2009 00:13:35 -0000 Received: (qmail 19137 invoked by uid 22791); 5 Sep 2009 00:13:34 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=BAYES_00,J_CHICKENPOX_66 X-Spam-Check-By: sourceware.org Received: from mail35d.att-webhosting.com (HELO mail35d.att-webhosting.com) (161.58.104.164) by sourceware.org (qpsmtpd/0.43rc1) with SMTP; Sat, 05 Sep 2009 00:13:29 +0000 Received: from mx78.stngva01.us.mxservers.net (204.202.242.149) by mail35d.att-webhosting.com (RS ver 1.0.95vs) with SMTP id 1-0350979606 for ; Fri, 4 Sep 2009 20:13:26 -0400 (EDT) Received: from unknown [198.66.164.83] (EHLO mxw3501.att-webhosting.com) by va1-mx78.stngva01.us.mxservers.net (mxl_mta-3.1.0-05) with ESMTP id 62da1aa4.2649590688.983790.00-011.va1-mx78.stngva01.us.mxservers.net (envelope-from ); Fri, 04 Sep 2009 20:13:26 -0400 (EDT) Received: (qmail 9961 invoked from network); 5 Sep 2009 00:13:26 -0000 Received: from unknown (HELO ?10.71.0.127?) (selcuk@66.255.177.98) by with ESMTPA; 5 Sep 2009 00:13:26 -0000 Subject: Re: recursive user-defined commands and From: Selcuk Kopru Reply-To: selcuk.kopru@tyazilimevi.com To: gdb@sourceware.org In-Reply-To: References: <1250118614.3975.43.camel@selcuk-laptop> <1252092562.3662.8.camel@selcuk-laptop> Content-Type: text/plain Date: Sat, 05 Sep 2009 00:13:00 -0000 Message-Id: <1252109601.3667.47.camel@selcuk-laptop> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-MAIL-FROM: X-SF-Loop: 1 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: 2009-09/txt/msg00099.txt.bz2 Hi, Thanks for the reply. I'm making progress but was not able to solve the problem yet. The following 3 examples didn't work, all giving "A syntax error in expression, near `)malloc(..." message: 1) set variable $myvar = (List::LNode**)malloc(10 * sizeof(List::LNode*)) 2) set variable $myvar = (List::LNode*)malloc(10 * sizeof(List::LNode)) 3) set variable $myvar = ((struct List::LNode)*)malloc(10 * sizeof(List::LNode)) The following 2 commands work as expected. 4) p sizeof(struct List::LNode) $81 = 12 5) p sizeof(List::LNode) $81 = 12 But the following do not work even if I put parentheses everywhere. 6) p sizeof(struct List::LNode*) 7) p sizeof(List::LNode*) Using void* didn't help as it wasn't possible to cast to the LNode* type. Thanks, selcuk On Fri, 2009-09-04 at 13:31 -0600, Tom Tromey wrote: > >>>>> ">" == Selcuk Kopru writes: > > >> How can we allocate an array type convenience variable? > > set variable $var = (type *) malloc (count * sizeof (type)) > > Tom