From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kristof Provost Subject: Re: can't initialize a constant using another constant? Date: Wed, 27 Feb 2008 08:09:57 +0000 Message-ID: <20080227080957.GB13641@nereid> References: <47C422E6.8050702@gmail.com> Mime-Version: 1.0 Return-path: Content-Disposition: inline In-Reply-To: <47C422E6.8050702@gmail.com> Sender: linux-c-programming-owner@vger.kernel.org List-ID: Content-Type: text/plain; charset="us-ascii"; x-action="pgp-signed" Content-Transfer-Encoding: 7bit To: Shriramana Sharma Cc: Linux C Programming List -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 2008-02-26 20:02:06 (+0530), Shriramana Sharma wrote: > Dear list, > > Quite some time since I wrote. I hope you are all keeping well. :) > > A strange thing I ran across this evening. I was not allowed to do: > > const double lunarSynodicMonth = 29.53059 ; > const double daysLunarPhaseAngleTakesPerDegree = lunarSynodicMonth / 360.0 ; > > I got the following error: > > wdf-karanas.c:17: error: initializer element is not constant > make: *** [wdf-karanas.o] Error 1 > > I would be grateful if anyone could shed some light. TIA. What compiler are you using? I did a quick test on g++ 4.1.2 (x86_64) and it seemed to be accepted without warning. Kristof -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFHxRrVUEZ9DhGwDugRAjZBAJ9pl0mGAJHPGbwePR0DVXoVh4kRzwCgnTn2 zzdeiILqi1JZ9M9VbUBewr8= =KWWv -----END PGP SIGNATURE-----