Hi, On Wednesday 02 February 2011, Julian Seward wrote: > On Wednesday, February 02, 2011, Cédric Lachat wrote: > > > > It's the "size == 3i" bit. I guess that's a typo, but why gcc accepts > > > it, who knows. (Well, not me, anyway). > > > > > > What happens if you change "3i" to "3" ? > > > > The file compiles but is it correct ? > > Well, size is a 32-bit unsigned int, so it's just trying to > compute "size == 3". The question is why does gcc accept this > trailing "i" on the 3.
I was curious and looked it up. Complex float numbers are C99, so "3.0i" is a complex literal with real value 0.0 and imaginary value 3.0. As GCC extension, gcc accepts complex integer numbers with the same notation. It looks like GCC parses "3i" as complex integer literal, and implicitly casts to a regular integer without warning, which then would become "size == 0", which obviously is not the right thing here. Josef > > J > > ------------------------------------------------------------------------------ > Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! > Finally, a world-class log management solution at an even better price-free! > Download using promo code Free_Logger_4_Dev2Dev. Offer expires > February 28th, so secure your free ArcSight Logger TODAY! > http://p.sf.net/sfu/arcsight-sfd2d > _______________________________________________ > Valgrind-users mailing list > Valgrind-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/valgrind-users > ------------------------------------------------------------------------------ Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d _______________________________________________ Valgrind-users mailing list Valgrind-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/valgrind-users