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
Post a Comment