home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / os / msdos / programm / 8046 < prev    next >
Encoding:
Text File  |  1992-07-23  |  2.0 KB  |  61 lines

  1. Path: sparky!uunet!sun-barr!cs.utexas.edu!ut-emx!ccwf.cc.utexas.edu
  2. From: ifai645@ccwf.cc.utexas.edu (Paul C. Janzen)
  3. Newsgroups: comp.os.msdos.programmer
  4. Subject: BC++ 3.0--general protection fault???
  5. Message-ID: <76497@ut-emx.uucp>
  6. Date: 24 Jul 92 05:22:56 GMT
  7. Sender: news@ut-emx.uucp
  8. Organization: The University of Texas at Austin, Austin TX
  9. Lines: 50
  10.  
  11. I've had a heck of a time tracing this one down, but the following code
  12. fragment totally trashes either the IDE or the command-line compiler. 
  13.  
  14. Is an error message too much to ask for?
  15.  
  16. I'd appreciate it if one or two of you could see if you get the same
  17. results I do. Also, if you can figure out something inherently wrong
  18. with this code, let me know. 
  19.  
  20. ------
  21. #include <\bc\classlib\include\strng.h>
  22.  
  23. class test {
  24. public:
  25.     test(String &s1, String &s2):
  26.          sa(s1),  sb(s2) {}
  27. private:
  28.     String sa;
  29.     String sb;
  30. };
  31.  
  32. test t1( "hi", "there"); // the compiler should construct 2 Strings on the fly
  33.              // to pass to test::test
  34.  
  35. int main(){}
  36.  
  37. ------
  38.  
  39. And here's the screen after it finishes compiling and begins to link:
  40.  
  41.  
  42. EXCEPTION 13:general protection fault at 0A7F:03C0 error code 4154
  43.              ax=4144,bx=003A,cx=0000,dx=4154,di=0010,si=0001
  44.              ds=05C7 limit=FFFF segment# 004C C:\BC\BIN\BC.EXE
  45.              es=19C7 limit=1107 segment#      
  46.              cs=0A7F limit=103A segment# 00AF C:\BC\BIN\BC.EXE
  47.              ss=05C7 limit=FFFF segment# 004C C:\BC\BIN\BC.EXE
  48.              error code=4154 limit=INVL segment#     
  49.              strike any key to continue
  50.  
  51. How annoying....This happens under both OS/2 and DOS, with all kinds 
  52. of memory settings. If you only have one String, it doesn't happen. If
  53. you pass the whole String, instead of a reference, it doesn't happen. 
  54.  
  55. Thanks for your help.
  56.  
  57. ------------------------------------------------------------------------
  58. Paul C. Janzen                You can create your own opportunities this
  59. ifai645@ccwf.cc.utexas.edu    week.  Blackmail a senior executive.
  60. ------------------------------------------------------------------------
  61.