From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6043 invoked by alias); 9 Sep 2002 23:14:47 -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 6035 invoked from network); 9 Sep 2002 23:14:46 -0000 Received: from unknown (HELO jackfruit.Stanford.EDU) (171.64.38.136) by sources.redhat.com with SMTP; 9 Sep 2002 23:14:46 -0000 Received: (from carlton@localhost) by jackfruit.Stanford.EDU (8.11.6/8.11.6) id g89NEkJ31556; Mon, 9 Sep 2002 16:14:46 -0700 X-Authentication-Warning: jackfruit.Stanford.EDU: carlton set sender to carlton@math.stanford.edu using -f To: gdb Subject: naive GDB programming style questions Content-Type: text/plain; charset=US-ASCII From: David Carlton Date: Mon, 09 Sep 2002 16:14:00 -0000 Message-ID: User-Agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Common Lisp) MIME-Version: 1.0 X-SW-Source: 2002-09/txt/msg00062.txt.bz2 1) It seems to me that some parts of GDB's source use NULL while other parts use 0. Is one or the other of these generally preferred? 2) Am I correct in observing that GDB frowns on code like the following: char *p = calculate_p (); if (!p) p_is_zero (); preferring this instead? char *p = calculate_p (); if (p == NULL) p_is_zero (); Does it matter that p in a pointer rather than an integer, or that the code is testing for zeroness rather than nonzeroness? 3) Is it possible to get CC Mode to indent in the way that GDB seems to prefer? I'm having a hard time getting structs to be indented as follows: struct foo { int mem; }; without screwing up my preferred indentation when doing non-GDB programming, namely struct foo { int mem; }; Of course, I can write functions to toggle between the two; but given that both styles seem to be able to coexist for enums, maybe it's possible to get them to coexist for enums. (I'm certainly no CC Mode expert...) David Carlton carlton@math.stanford.edu