Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!sol.ctr.columbia.edu!srcsip!msi-s0.msi.umn.edu!cs.umn.edu!uc!shamash!hewey!ian From: ian@dms.cdc.com (Ian Hogg) Newsgroups: comp.lang.c++ Subject: Initialization of static class members? Message-ID: <114@hewey.dms.cdc.com> Date: 26 Sep 90 00:09:16 GMT Organization: Control Data, Empros Division, Plymouth, MN Lines: 25 The following compiles and executes with g++. It does not compile with HP's C++ or Oregon Software C++ 2.0. class butthead { . . . static int n = 2; int c = 1; . . . }; Which compiler(s) is correct? I find it a big pain to have to explicity initialize n & c for every constructor I may have. The big problem is with the static member. I would like this initialized exactly once not every time an instance of butthead is created. Please respond directly via e-mail since I don't have news set up 100% right now. -- Ian Hogg x-4484