Re: variable initialization / I'm a n00b
- From: rlb@xxxxxxxxxxxxxxxxxxxxxx (Richard Bos)
- Date: Wed, 31 Jan 2007 17:33:50 GMT
"rjtucke" <rjtucke@xxxxxxxxx> wrote:
Hi all- this is my first post here- just a quick question:
#include <math.h>
double foo = cosh(0.621);
int main() {
return 0;
}
fails with
error: initializer element is not constant
Yes? Initialisers for static-duration objects (i.e., "global" objects,
and "local" objects you've declared using static) must be compile-time
constants, and a function call is not a compile-time constant, even if
all its arguments are.
In addition to telling me what I'm doing wrong, could you please refer
me to an appropriate reference for related questions?
K&R.
Richard
.
- References:
- variable initialization / I'm a n00b
- From: rjtucke
- variable initialization / I'm a n00b
- Prev by Date: Re: fseek and open_memstream
- Next by Date: Re: How to reduce Zero Initialised region.
- Previous by thread: variable initialization / I'm a n00b
- Next by thread: Re: variable initialization / I'm a n00b
- Index(es):