home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!Germany.EU.net!starlab!mi
- From: mi@starlab.UUCP (Michael Hoennig)
- Newsgroups: comp.lang.c++
- Subject: using this in initializer list generates warning
- Summary: should it be allowed to use this befor *this is initialized?
- Keywords: this,initialization,base-class pointer
- Message-ID: <3927@starlab.UUCP>
- Date: 3 Sep 92 06:39:29 GMT
- References: <1992Aug29.184025.328@frumious.uucp> <rmartin.715267769@thor> <23598@alice.att.com>
- Organization: StarDivision GmbH, D-2000 Hamburg, Germany
- Lines: 38
-
- In article <23598@alice.att.com> ark@alice.UUCP () writes:
-
- >The unfortunate reality is that I have seen a number of development
- >projects that have an inflexible rule -- no warnings allowed! That is,
- >they will not allow their people to ship any code that generates warnings.
-
- In this context we have a problem with the Microsoft C++ 7.0. We too
- should not ship sourch wich generates warnings (but exceptions are
- allowed - it's not a strikt rule). But in the following situation
- the MSC7.0 comiler generates a warning: this used befor initialization.
-
- class Window;
- class Button: public Window ...
-
- class Dialog: public Window
- {
- Button aBtn;
- ... some more stuff
- public:
- Dialog( Window *pParent ):
- Window( pParent ),
- aBtn( this ) // here comes up the warning
- {...}
- ...
- };
-
- Although I use this as a Window* and the *(Window*)this is already
- initialized - the warning comes up. What can we do? To set the parent
- after construction is a bad idea it makes code awful and we must
- create the Windows on the level of GUI later too because
- there are GUI where the parent can't be canged (OLIT, Motif).
-
- Adios
- --
- Michael Hoennig FAX: +49 40 23 646 550
- StarDivision GmbH Phone: +49 40 23 646 500
- Sachsenfeld 4 uucp: ...!unido!starlab!mi
- D-W-2000 Hamburg 1 domain: mi@starlab.uucp
-