c - Why can't gsl_vector_alloc be called before main starts? -



c - Why can't gsl_vector_alloc be called before main starts? -

from 21st century c book:

static variables, within of function, initialized when programme starts, before main, can’t initialize them nonconstant value.

//this fails: can't phone call gsl_vector_alloc() before main() starts static gsl_vector *scratch = gsl_vector_alloc(20);

why can't gsl_vector_alloc called before main starts?

what quoted book answer, i.e. because wouldn't compliant c standard.

all expressions in initializer object has static storage duration shall constant expressions or string literals.

although believe possible in c++ under conditions.

c static gsl

Comments

Popular posts from this blog

php - How to pass multiple values from url -

database - php search bar when I press submit with nothing in the search bar it shows all the data -

ios - How to load .png images from Documents folder of an app -