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

  1. Path: sparky!uunet!mcsun!fuug!demos!kiae!glas!demos!newshub.a!ariel.yorku.ca!cs911209
  2. From: cs911209@ariel.yorku.ca
  3. Newsgroups: comp.lang.c++
  4. Date: 18 Jul 92 03:50 MDT
  5. Subject: Re: boolean (was: Re: typedef vs enum)
  6. Sender: Notesfile to Usenet Gateway <notes@glas.apc.org>
  7. Message-ID: <1992Jul17.235055.13535@newshub.a>
  8. References: <1992Jul11.195547.18323@cmcl2.nyu>
  9. Nf-ID: #R:1992Jul11.195547.18323@cmcl2.nyu:1382747533:1992Jul17.235055.13535@newshub.a:231667568:001:1037
  10. Nf-From: ariel.yorku.ca!cs911209    Jul 18 03:50:00 1992
  11. Lines: 36
  12.  
  13.  
  14. In article <DOUGM.92Jul17133255@titan.cs.rice.edu> dougm@titan.cs.rice.edu (Doug Moore) writes:
  15. >In article <23195@alice.att.com> ark@alice.att.com (Andrew Koenig) writes:
  16. >Andrew> I would love to see a built-in Boolean type in C++, but
  17. >Andrew> unfortunately it's too big a change from C.
  18. >
  19.     6 lines deleted..
  20.  
  21. >I would also love to see a built-in Boolean type in C++.  I would
  22. >gladly engage in a discussion on how it could be done.  What specific
  23. >problems do you believe make a Boolean-type extension to C++
  24. >infeasible?
  25. >
  26.  
  27.     One thing that makes C a nice language to program in, is the fact
  28. that NULL and 0 can mean false, and non-NULL and non-zero can mean true.
  29.     I would like to see some kind of consistent boolean type in C++,
  30. but I would also like to be able to say:
  31.  
  32. SomeObject *ptr;
  33. ...
  34. while (ptr)
  35. ...
  36.  
  37.     and:
  38.  
  39. if (!(fptr = fopen( "myfile", 'r')))
  40.  
  41.     etc.
  42.  
  43.     I think the best way to do this would be to have some typecasting
  44. rules from int to boolean and from pointer types to boolean.
  45.  
  46. Michael Davis            York University, Toronto
  47.  
  48.  
  49.