This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GCC 3.1.1 --std=c99: initializer element is not constant ...



Hi There,

  I have some code that compiles fine with GCC 3.0.x but fails with GCC
3.1.x with an "initializer element is not constant" error.  Here is the
smallest example I could find:

--------------
typedef struct Lock Lock;

struct Lock {
	void *holder;
};

Lock lock = (Lock){ (void*)0 };
--------------

  Using GCC 3.0.x it builds fine with both "--std=c89" and "--std=c99" but
with "GCC 3.1.1 20020525 (prerelease)" it only builds with "--std=c89" and
fails with the "initializer element is not constant" error with
"--std=c99".  Is there some reason why "NULL (void *)0" is not constant
anymore in "c99"?

	Thanks,

		CraigN
--
      Craig Newell                email: CraigN@ieee.org
      Free Spirit                 icbm:  N 42°38'47" W 71°18'19"



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]