Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <ac131313@cygnus.com>
To: Fernando Nasser <fnasser@redhat.com>
Cc: Eli Zaretskii <eliz@is.elta.co.il>, gdb-patches@sources.redhat.com
Subject: Re: [rfa/cli] s/NO_FUNCTION/NULL/
Date: Mon, 21 Jan 2002 10:37:00 -0000	[thread overview]
Message-ID: <3C4C5FC4.6030609@cygnus.com> (raw)
In-Reply-To: <3C4C46E8.F48A93D7@redhat.com>


>> 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


  parent reply	other threads:[~2002-01-21 18:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-01-02  8:15 Andrew Cagney
2002-01-20 15:17 ` Andrew Cagney
2002-01-21  1:51   ` Eli Zaretskii
2002-01-21  8:51     ` Fernando Nasser
2002-01-21  9:19       ` Eli Zaretskii
2002-01-21 10:37       ` Andrew Cagney [this message]
2002-01-22  0:57         ` Eli Zaretskii
2002-01-28 20:51           ` Andrew Cagney
2002-01-29  2:10             ` Eli Zaretskii
2002-01-31 21:49               ` Andrew Cagney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3C4C5FC4.6030609@cygnus.com \
    --to=ac131313@cygnus.com \
    --cc=eliz@is.elta.co.il \
    --cc=fnasser@redhat.com \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox