This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: RFA: complex numbers in c-valprint.c
- From: Daniel Jacobowitz <drow at mvista dot com>
- To: Jim Blandy <jimb at zwingli dot cygnus dot com>
- Cc: gdb-patches at sources dot redhat dot com
- Date: Sun, 3 Feb 2002 17:52:27 -0500
- Subject: Re: RFA: complex numbers in c-valprint.c
- References: <20020130233143.A21333@nevyn.them.org> <npk7tuw5gd.fsf@zwingli.cygnus.com>
On Sun, Feb 03, 2002 at 05:44:50PM -0500, Jim Blandy wrote:
>
> Daniel Jacobowitz <drow@mvista.com> writes:
> > This patch fixes half of gdb/320. The other half is a bug in GCC 3.x, that
> > I just CC'd gdb@ about.
> >
> > Is this OK to commit? Does anyone have a preference for {0, 0} vs. { re =
> > 0, im = 0}? I used the former.
>
> {0, 0} looks to me like GDB's syntax for array literals. In ISO C
> programs, don't you just write complex literals as x+I*y? What's wrong
> with GDB printing that?
>
> If you say, "It shouldn't be an expression!", then I'll just say, "We
> already print negative numbers as an expression!" Lexically speaking,
> C integer literals can't have a sign. `-3' is an application of the
> prefix operator `-' to the literal `3'. Since the spec promises that
> the compiler will fold constant expressions, you don't need a
> dedicated syntax for negative numbers. I assume the same thinking is
> behind the lack of any syntactic support for complex literals.
x + y * I, I think. That's nice; I didn't realize C99 and <complex.h>
supported ``I''.
OK with that syntax change?
> (The bikeshed should be a nice yellow-green, I think.)
...
--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer