From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 476 invoked by alias); 15 Sep 2003 17:21:01 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 442 invoked from network); 15 Sep 2003 17:21:00 -0000 Received: from unknown (HELO mail-srv2.micron.com) (137.201.242.130) by sources.redhat.com with SMTP; 15 Sep 2003 17:21:00 -0000 Received: from mail-srv2.micron.com (localhost [127.0.0.1]) by mail-srv2.micron.com (8.12.9/8.12.2) with ESMTP id h8FHL06f022963 for ; Mon, 15 Sep 2003 11:21:02 -0600 (MDT) Received: from ntxboimbx07.micron.com (ntxboimbx07.micron.com [137.201.80.94]) by mail-srv2.micron.com (8.12.9/8.12.2) with ESMTP id h8FHKwcW022937; Mon, 15 Sep 2003 11:20:59 -0600 (MDT) From: lrtaylor@micron.com X-MimeOLE: Produced By Microsoft Exchange V6.0.6375.0 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: RE: Error on Member Initialization Date: Mon, 15 Sep 2003 17:21:00 -0000 Message-ID: <363801FFD7B74240A329CEC3F7FE4CC40D335C@ntxboimbx07.micron.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: To: , , X-Scanned-By: MIMEDefang 2.33 (www . roaringpenguin . com / mimedefang) X-SW-Source: 2003-09/txt/msg00172.txt.bz2 Eljay, While that's the _preferred_ way to initialize member variables in C++, tha= t's not always possible; sometimes you need to do more complex things to in= itialize your class (e.g., if you need to initialize variables differently = based on certain conditions, retrieve information from a database, etc.). = Is there any _real_ difference between these two ways of initializing? radApp::radApp() : m_MyServer(&Log) {} radApp ::radApp() { m_MyServer =3D &Log ; } Thanks, Lyle Taylor IS Applications -----Original Message----- From: Eljay Love-Jensen [mailto:eljay@adobe.com] Sent: Saturday, September 13, 2003 8:28 AM To: Allen Williams; gcc-help@gcc.gnu.org Subject: Re: Error on Member Initialization Hi Allen, That's not how you initialize a member variable in C++. (Although it's ver= y close to how you do it in Java.) You need to put the initialization in your radApp's constructor's initializ= ation list. e.g.: radApp::radApp() : m_MyServer(&Log) { } HTH, --Eljay