Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!tut.cis.ohio-state.edu!sei!ajpo!rabbieh From: rabbieh@ajpo.sei.cmu.edu (Harold Rabbie) Newsgroups: comp.lang.c Subject: Expressions in initializers Keywords: initializers Message-ID: <760@ajpo.sei.cmu.edu> Date: 4 Mar 91 01:34:08 GMT Lines: 25 Here's one for the comp.lang.c.lawyers - K&R 2 says (without explanation) that non-constant expressions can be used as initializers only for static scalars, not for automatics, and not for aggregates. e.g. I can say: static double x = sqrt( 2.0 ); but I can't say: void foo( void ) { double x = sqrt( 2.0 ); } nor can I say: static struct foo { double x; } bar = { sqrt( 2.0 ) }; What's the deal here - is ANSI easing up on those no-good implementers :-) or is there a valid reason for this restriction? P.S. No need to FAQ me over on this one.