From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12827 invoked by alias); 21 Jan 2002 18:37:07 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 12727 invoked from network); 21 Jan 2002 18:36:56 -0000 Received: from unknown (HELO localhost.cygnus.com) (24.114.42.213) by sources.redhat.com with SMTP; 21 Jan 2002 18:36:56 -0000 Received: from cygnus.com (localhost [127.0.0.1]) by localhost.cygnus.com (Postfix) with ESMTP id E401E3F0E; Mon, 21 Jan 2002 13:36:52 -0500 (EST) Message-ID: <3C4C5FC4.6030609@cygnus.com> Date: Mon, 21 Jan 2002 10:37:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-US; rv:0.9.7) Gecko/20020103 X-Accept-Language: en-us MIME-Version: 1.0 To: Fernando Nasser Cc: Eli Zaretskii , gdb-patches@sources.redhat.com Subject: Re: [rfa/cli] s/NO_FUNCTION/NULL/ References: <3C4C46E8.F48A93D7@redhat.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2002-01/txt/msg00654.txt.bz2 >> IMHO, someone should test this change with the latest versions of GCC, >> including their development line: they could have their own ideas when >> you are allowed to pass NULL, especially with all the warning options >> we use. My ISO C is pretty rusty, however my memory is that NULL is very very special. GCC might do be doing some strange things but they won't extend to things like: cmd->function.cfunc = NULL; if (cmd->function.cfunc) or if (cmd->function.cfunc == NULL) With regard to parameters, GDB is fully parameterized so that isn't a problem. GDB built with GCC 3.0.3. Using current GCC things died mysteriously part way through the build. > Besides, the NO_FUNCTION documents the meaning better than NULL > (although most people should guess). Maybe you can add a comment > somewhere nearby. > > Any chance Eli's concerns become true and we get a warning because > NULL is not typed properly? Maybe you would need a cast (in which > case I would prefer the NO_FUNCTION def. If we're going to have a cast NULL pointer for cfunc (NO_FUNCTION) then we're going to need to do similar for every single function pointer in GDB. I really can't see anyone doing that. Anyway, per my original e-mail , a quick look through the CLI code reveals that even the CLI doesn't follow its own convention. The CLI uses: if (cmd->function.cfunc == NULL) and if (cmd->function.cfunc) intead of: if (cmd->function.cfunc == NO_FUNCTION) (the latter occures just once). This leads me to conclude that NO_FUNCTION ``was simply a good idea at the time''. One of those conventions that looks good but doesn't actually improve things. enjoy, Andrew