Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uunet!cos!patrick From: patrick@cos.com (Patrick Steranka) Newsgroups: comp.lang.c++ Subject: Can you define global variables that are of a type "class" Keywords: novice question, c++ constructors Message-ID: <24672@cos.com> Date: 30 Nov 89 17:09:01 GMT Organization: Corporation for Open Systems, McLean, VA Lines: 21 I have a question about how constructors work. In particular, (1) Can you define a variable of a given class as a global? (2) If you can, when is the "constructor" for this called? (e.g., before the "main()" routine is started (I would imagine)) When I tried to do this (just for the sake of learning) I got the following ASSEMBLY LANGUAGE ERROR message: as: error (/usr/zulu/patrick/tmp/cca18777.s:2776): Invalid operand If this is not allowed, then GNU's g++ (gcc version 1.36.1) should probably catch this error and NOT let this error get down the gnu's assembler. If it is allowed, then the g++ compiler should be fixed to allow this, or am I missing something? Should I send this to the g++ bugs list? patrick (Patrick Steranka @ Corporation for Open Systems) -- patrick@cos.com -- patrick%cos.com@uunet.uu.net -- {uunet, sundc, decuac, hqda-ai, hadron}!cos!patrick