From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2075 invoked by alias); 12 Sep 2002 18:35:54 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 2066 invoked from network); 12 Sep 2002 18:35:53 -0000 Received: from unknown (HELO localhost.redhat.com) (216.138.202.10) by sources.redhat.com with SMTP; 12 Sep 2002 18:35:53 -0000 Received: from ges.redhat.com (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id 96E133C44; Thu, 12 Sep 2002 14:35:50 -0400 (EDT) Message-ID: <3D80DE86.2070407@ges.redhat.com> Date: Thu, 12 Sep 2002 11:35:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-US; rv:1.0.0) Gecko/20020824 X-Accept-Language: en-us, en MIME-Version: 1.0 To: David Carlton Cc: gdb Subject: Re: naive GDB programming style questions References: <3D7D4ED2.2050401@ges.redhat.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2002-09/txt/msg00120.txt.bz2 PS: If you encounter a file that has the old ``dud'' struct style indentation then running it (otherwize unchanged) through gdb_indent.sh comes under the ``obvious fix rule''. It lets you get any indentation issues out of the way up before you start making changes. Andrew > On Mon, 09 Sep 2002 21:45:54 -0400, Andrew Cagney said: > > >> I'll assume that you ment ``p_is_null()''. > > > Right. > > >> If you've a copy of the ISO C and C++ manuals, have a look at what >> they have to say about ``NULL'' pointers. It's weird. > > > Really? Hmm. I know that NULL doesn't work as well in C++ as it does > in C, so I've gotten used to using 0 there. > > Though if you're referring to the fact that NULL's underlying bit > representation might not be 0, I'm not sure that's a big deal here. > > >> Anyway, for GDB, ``p == NULL'' is recommended to make it clear that >> the pointer is being tested and not the underlying value. > > > Okay, then that's what I'll do. > > >> Just use: > > >> struct foo >> { >> int mem; >> }; > > >> which is what is output by gdb_indent.sh and emacs. > > > Excellent. > > David >