From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12329 invoked by alias); 8 Apr 2003 18:15:55 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 12307 invoked from network); 8 Apr 2003 18:15:54 -0000 Received: from unknown (HELO ns2.jaj.com) (66.93.21.106) by sources.redhat.com with SMTP; 8 Apr 2003 18:15:54 -0000 Received: by ns2.jaj.com (Postfix, from userid 1002) id 6298A2C472; Tue, 8 Apr 2003 14:15:51 -0400 (EDT) Date: Tue, 08 Apr 2003 18:57:00 -0000 From: Phil Edwards To: Mehdi Khaldi Cc: "'gcc@gcc.gnu.org'" Subject: Re: about gcc library Message-ID: <20030408181551.GA5793@disaster.jaj.com> References: <719596FEB24CD6119DDE00508B8B831D5E72@softaddictsrv01.intsoftaddicts.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <719596FEB24CD6119DDE00508B8B831D5E72@softaddictsrv01.intsoftaddicts.com> User-Agent: Mutt/1.5.3i X-SW-Source: 2003-04/txt/msg00325.txt.bz2 On Tue, Apr 08, 2003 at 12:29:17PM -0400, Mehdi Khaldi wrote: > Hi, > How to check if a pointer is allocated or not? > > I do "if(p == NULL)". This assumes that the developer did "p = NULL;" > But if he didn't do that, how can I know if the pointer is allocated or not? > > Example : > > Int *p; > > If(p == NULL) > Printf("P = NULL\n"); > Else > Memset(p, 0, sizeof(int)); > > I'd like to know if the pointer is allocated. That's not how the C language works. You need a textbook. This list is for the development /of/ GCC itself, not how to program in C. -- If ye love wealth greater than liberty, the tranquility of servitude greater than the animating contest for freedom, go home and leave us in peace. We seek not your counsel, nor your arms. Crouch down and lick the hand that feeds you; and may posterity forget that ye were our countrymen. - Samuel Adams