home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: gnu.gcc.bug
- Path: sparky!uunet!cis.ohio-state.edu!dcs.ed.ac.UK!ret
- From: ret@dcs.ed.ac.UK (Rik)
- Subject: Yet another one
- Message-ID: <4118.9208112009@garay.dcs.ed.ac.uk>
- Sender: gnulists@ai.mit.edu
- Organization: GNUs Not Usenet
- Distribution: gnu
- Date: Tue, 11 Aug 1992 20:09:32 GMT
- Approved: bug-gcc@prep.ai.mit.edu
- Lines: 24
-
- >From Reference manual r.13.4.7 Increment & decrement :
-
- class X {
- public: X operator++() { a=2 ; return *this ;}
- X operator++(int) { a=5 ; return *this ;}
- int a ;
- };
-
- main () {
- X var ;
- ++var ;
- printf("%d\n",var.a) ;
- var++ ;
- printf("%d\n",var.a) ;
- }
-
- Prints 2 twice. Replace the postincrement call var++ with var.operator++(0)
- and it works.
-
- > Richard Eyre-Todd. Department of Computer Science, University of Edinburgh.
-
- > Email: ret@uk.ac.ed.dcs | Solid fuel is for camp-fires,
- > or ret%dcs.ed.ac.uk@nsfnet-relay.ac.uk | not boosting Space Shuttles. :-)
-
-