Date: Wed, 6 Oct 1999 17:16:02 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: Andrew Hurrell cc: djgpp AT delorie DOT com Subject: Re: complex numbers In-Reply-To: <000601bf0fff$7b54dee0$6032893e@amh-home> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Wed, 6 Oct 1999, Andrew Hurrell wrote: > However if is simply examine foo then I obtain the real part of the > complex number. The only way I've found of obtaining the imaginary > part of the number is to use *(&(foo)+1). However, I note from the > gcc info page that gcc may store the real and imaginary parts of > complex numbers in entirely separate locations, and thus I would > guess that the above method is likely to be far from "safe". I have no personal experience debugging C programs that use complex variables. Anybody? However, you could examine the code produced by the version of GCC you are using now and establish whether it always stores the real and imaginary part consecutively (it makes sense to me that it would). If so, you could define a GDB function that prints foo and *(&foo+1) automatically, and put the definition of this function into your gdb.ini file. Then it would be more convenient for you to examine the values of complex variables, and if GCC ever changes in this respect, you will need to update your function. See the section about user-defined functions in the GDB manual, for more details.