home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / cplus / 11555 < prev    next >
Encoding:
Internet Message Format  |  1992-07-25  |  2.6 KB

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