Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!microsoft!jimad From: jimad@microsoft.UUCP (Jim ADCOCK) Newsgroups: comp.lang.c++ Subject: Re: Static member definition vs. declaration? Message-ID: <72218@microsoft.UUCP> Date: 7 May 91 23:52:12 GMT References: <1991Apr19.133728.5300@clear.com> <1991Apr30.195846.16760@ccad.uiowa.edu> Reply-To: jimad@microsoft.UUCP (Jim ADCOCK) Organization: Microsoft Corp., Redmond WA Lines: 17 |We have a debate in our group. When you declare a static |member, such as: | | class X {static int myVar;}; | |Do you need to make a definition elsewhere, | | int X::myVar; | In C++ static members are only allowed for global classes. The mention of such inside of the class is only a declaration, the actual definition must occur at file scope. Some C++ compilers allow declaration without such explicit definition. This is a *compiler* anachronism as listed in section 18.3 of ARM, not part of the C++ *language* as defined today.