home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / cplus / 13341 < prev    next >
Encoding:
Internet Message Format  |  1992-09-08  |  1.4 KB

  1. Path: sparky!uunet!bonnie.concordia.ca!daily-planet.concordia.ca!patrice
  2. From: patrice@cs.concordia.ca (SCATTOLIN patrice)
  3. Newsgroups: comp.lang.c++
  4. Subject: BC++ 3.1 BUG: getting an UNREACHABLE CODE WARNING!
  5. Message-ID: <4876@daily-planet.concordia.ca>
  6. Date: 5 Sep 92 20:27:57 GMT
  7. Sender: usenet@daily-planet.concordia.ca
  8. Organization: Computer Science, Concordia University, Montreal, Quebec
  9. Lines: 47
  10.  
  11.  
  12. I am using BC++ 3.1 and I get  compilation  warnings:
  13. one of which is:
  14.  
  15.  
  16.      WARNING: UNREACHABLE CODE in the following code at the next to last line:
  17.  
  18.  
  19.           tek_complex newcomplex(1,1);
  20.           SIGNALRANGE i;
  21.            cout <<"GAZOU\n";
  22.            getch();
  23.  
  24.  
  25.  
  26. However the program exeutes the statement that it claims is unreachable
  27. "cout<<"GAZOU\n"
  28.  
  29.  
  30.  
  31. The warning will disapear when I comment the following code:
  32.  
  33.  
  34.       friend ostream& operator<<(ostream& os, signal_buffer<sig>& a)
  35.            {
  36.                   SIGNALRANGE i;
  37.                   for (i=a.strt;i<a.end;i++)
  38.                     os << a.dv[i];
  39.                return os;
  40.              }
  41.  
  42.  
  43. This piece of code belongs to a templace declaring signal_buffer in a .h. 
  44. If anyone can provide an answer please tell me. It's an annoying 
  45. warning because it's wrong and you chase it down and can't do 
  46. anything about it!.
  47.  
  48. Thanks
  49.  
  50.  
  51.  
  52.  
  53. -- 
  54. Patrice Scattolin
  55.                     patrice@cs.concordia.ca
  56. Concordia University            Montreal, Canada
  57. "I am so far north that Santa lives two blocks from me"
  58.