l i n u x - u s e r s - g r o u p - o f - d a v i s
Next Meeting:
June 2: Social gathering
Next Installfest:
Latest News:
May. 19: LUGOD special elections
Page last updated:
2004 Jun 10 11:24

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] gdb segfaults when printing long double complexvariables
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] gdb segfaults when printing long double complexvariables

On Thu, Jun 10, 2004 at 08:21:55AM -0700, Peter Jay Salzman wrote:
> Bug: GDB segfaults when printing long double complex variables.
> Sample Code:
> 1       #include <tgmath.h>
> 2       #include <stdio.h>
> 3
> 4       int main(void)
> 5       {
> 6               complex a;
> 7               double complex b;
> 8               long double complex c;
> 9
> 10              a = 5 + 2I;
> 11              printf("%f + %fi\n", __real__ a, __imag__ a);
> 12
> 13              b = 5.0 + 2.0I;
> 14              printf("%f + %fi\n", __real__ b, __imag__ b);
> 15
> 16              c = 5.0L + 2.0LI;
> 17              printf("%Lf + %Lfi\n", __real__ c, __imag__ c);
> 18
> 19              return 0;
> 20      }

creal() and cimag() are more portable than __real__ and __imag__. You
should avoid the latter, as they are GNU extensions. See the GCC info
docs for more.

Micah J. Cowan
vox-tech mailing list

LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
Appahost Applications
For a significant contribution towards our projector, and a generous donation to allow us to continue meeting at the Davis Library.