l i n u x - u s e r s - g r o u p - o f - d a v i s
L U G O D
 
Next Meeting:
January 6: Social gathering
Next Installfest:
TBD
Latest News:
Nov. 18: Club officer elections
Page last updated:
2004 Sep 06 19:50

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] C99 - Initializing complex
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] C99 - Initializing complex



On Mon, Sep 06, 2004 at 06:12:47PM -0400, Peter Jay Salzman wrote:
> Must both parts of a complex variable be initialized:
> 
>    long double complex z = 0.0L + 0.0L*I;           (i)
> 
> or does only one part need to be initialized?
> 
>    long double complex z = 0.0L;                    (ii)
> 
> A test program shows that (ii) "works", but I couldn't find an authoritative
> answer in the C99 standard.  Although I have no intention of using anything
> but Linux, I still don't want to rely on GNU extensions (as much as
> possible).

The following paragraph winds a bit, but the most important bit is the
final sentence.

6.7.8#11 says that "the same type constraints and conversions as for
simple assignment apply...". In 6.5.16.1#1 (Simple Assignment:
Constraints), the applicable constraint that your (ii) fulfills is
that both operands must be arithmetic type (so now so far we are
guaranteed at least that a diagnostic has not been required). 6.7.8#11
states that the initial value of the declared object will be the value
of the initializer, after conversion; and 6.3.1.7#1 states that the
value of a complex object converted from a real is such that its real
part has the (converted) value of the real from which it was
converted, and the imaginary part is zero.

> BTW, my copy of the C99 standard is from August 3, 1998 and appears to be a
> "pre-release".  I'm a little surprised that a Google search for "C99
> standard" just doesn't give a copy of the standard the way a Google search
> for "US Constitution" yields the Constitution.  Where is the official copy of
> this standard?

webstore.ansi.org has it (ANSI being a member of the ISO). C99 is a
nickname: the language is still "The C Programming Language": the
official designation is ISO/IEC 9899:1999.

-- 
Micah J. Cowan
micah@cowan.name
_______________________________________________
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech



LinkedIn
LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
facebook
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:
Sunset Systems
Who graciously hosts our website & mailing lists!