home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / os / mswindo / programm / misc / 5421 < prev    next >
Encoding:
Text File  |  1993-01-28  |  2.2 KB  |  60 lines

  1. Newsgroups: comp.os.ms-windows.programmer.misc
  2. Path: sparky!uunet!think.com!spool.mu.edu!torn!nott!emr1!jagrant
  3. From: jagrant@emr1.emr.ca (John Grant)
  4. Subject: Re: Does anybody know this bug?
  5. Message-ID: <1993Jan27.022815.9125@emr1.emr.ca>
  6. Organization: Energy, Mines, and Resources, Ottawa
  7. References: <1993Jan23.150923.12794@ousrvr.oulu.fi> <C1Gp35.9Ez@sunlab1.bath.ac.uk>
  8. Date: Wed, 27 Jan 1993 02:28:15 GMT
  9. Lines: 49
  10.  
  11. In article <C1Gp35.9Ez@sunlab1.bath.ac.uk> mssshb@sunlab1.bath.ac.uk (S H Bowman) writes:
  12. >artoinas@phoenix.oulu.fi (Arto Oinas) writes:
  13. >
  14. [...stuff about some bug deleted...]
  15.  
  16. >This is a pretty general problem so try this general answer:
  17. >
  18. >Check your hdc and hwnd parameters in functions like EndPaint.
  19. >
  20. >I have mixed these up on numerous occasions and it has given exactly
  21. >the type of fault you describe, sometimes taking hours to sort out!
  22. >I can't understand why the STRICT compilation doesn't spot this.
  23.  
  24.     This is obvious, but it's worth a check - does your
  25.     #define STRICT appear *before* #include <windows.h>???
  26.  
  27.     Well EndPaint doesn't have an HDC, but ReleaseDC has both
  28.     HWND & HDC.  I just stuck the following in my code somewhere:
  29.         {HWND hwnd;
  30.         HDC hdc;
  31.         ReleaseDC(hdc,hwnd);    //this is WRONG
  32.         }
  33.  
  34.     and BC++ 3.1 gives me two "suspicious pointer conversion"
  35.     errors (also the obvious warning that hdc & hwnd are used
  36.     before being defined).  If I switch it around:
  37.         ReleaseDC(hwnd,hdc);    //this is RIGHT
  38.     then I don't get those 2 pointer warnings.
  39.  
  40.     It looks like STRICT is working for me, but then again I
  41.     have *every* single warning message turned on and I don't
  42.     go any further until they have all been fixed.  I can't
  43.     stress this enough for all of you programmers out there.
  44.     My app is 22k lines of code and I don't get a single warning
  45.     message when I do a full build (with all warnings turned on).
  46.  
  47.     I only used #pragma argsused in a couple of places where I
  48.     have some unused function parameters in place (for future
  49.     expansion).  Everything is fully prototyped and as bugtight
  50.     as I could make it, and I *still* get the odd bug or two
  51.     (as expected).
  52.  
  53. John A. Grant                        jagrant@emr1.emr.ca
  54. Airborne Geophysics
  55. Geological Survey of Canada, Ottawa
  56. -- 
  57. John A. Grant                        jagrant@emr1.emr.ca
  58. Airborne Geophysics
  59. Geological Survey of Canada, Ottawa
  60.