home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!cis.ohio-state.edu!ucbvax!ROUTH.KOSUFY.LU.SE!KOSU_MATSB
- From: KOSU_MATSB@ROUTH.KOSUFY.LU.SE
- Newsgroups: comp.lang.c++
- Subject: Having this=0, class-name::main() and tasking in c++
- Message-ID: <1DDA4ACFA5BF800C41@ursula.lucas.lu.se>
- Date: 26 Jul 92 02:31:19 GMT
- Sender: daemon@ucbvax.BERKELEY.EDU
- Lines: 48
- X-Unparsable-Date: Sun, 26 Jul 92 04:38 GMT+02
-
- Two (three) questions on C++:
-
- Question #1: Having a 0 "this" pointer. Standard?
- If i happen to use a method using an explicit pointer to
- an object which for some reason of another happens to be
- 0 (which i probably don't want to do ;-) i have noticed
- that G++ (ver 2.2.2 for VAX/VMS) get's a bit carried away
- when the method starts to access the items of the object.
- However, it is possible to catch this since the "this"
- pointer is 0 and a controlled exit is possible. If the
- method is virtual the program crashes at the call
- (naturally). Is this of a 0 "this" pointer in a method
- within the standards of C++ or a feature of G++?
- (i.e. can i use the feature in a program and expect it to
- work on another type of machine and copmiler?)
-
-
- Question #2: class_name::main() & coroutines/threads/tasks in C[++]
- Reading the newsgroups "comp.lang.c++" and "comp.std.c++"
- i get the impression of some developement of the language.
- Since i am not alltogether unexperienced in MODULA-2 and
- (as You might have guessed by these questions) just
- recently started with C++ i miss two of the best parts in
- MODULA-2.
-
- a; Im M2 each implementation module have a part
- initializing the module. A similar opportunity to
- initialize a class would be a very powerful tool.
- The to me natural choise for such a tool would be
- "int class_name::main()" (the program would terminate
- if the return value != 0). I know it is quite simple to
- simulate this in C++, but a standard would be cleaner.
- I know there are problems if a class initialiser uses a
- class depending of being initialized but not yet so...
-
- b; The M2 coroutine/task concept is VERY powerful when
- making asynchonic programs. Are there any plans to
- incorporate this in C++/C?
-
-
- Sincerely/Mats Bergstrvm.
- ----------------------------------- -----------------------------------
- Mats Bergstrvm mats.bergstrom@kosufy.lu.se
- Div of Cosmic and Subatomic Physics kosu_matsb@130.235.92.17
- Department of Physics ROUTH::KOSU_MATSB (ROUTH::=57412::)
- University of Lund Phone: (+46)104767
- SWEDEN. Fax: (+46)104709
- ----------------------------------- -----------------------------------
-