home *** CD-ROM | disk | FTP | other *** search
/ The Developer Connection…ice Driver Kit for OS/2 3 / DEV3-D1.ISO / source / bento / headers / qdfix.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-03-02  |  1.3 KB  |  42 lines

  1. /*
  2.     File:        QDFix.h
  3.  
  4.     Contains:    Fix for QuickDraw.h   [Mac Only]
  5.  
  6.     Written by:    Jens Alfke, Tantek éelik
  7.  
  8.     Copyright:    ⌐ 1993 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.          <1>     1/31/94    JA        first checked in
  13.     To Do:
  14.     
  15.     Theory of Operation:
  16.  
  17.     We've had a lot of trouble with QuickDraw.h defining an enum constant called "frame" whose
  18.     value is zero. If a function uses a local variable "frame" but forgets to define it, the
  19.     global frame is used instead. Since it's zero, which can be cast implicitly to NULL, this
  20.     usually results in a null pointer being used instead of an XMPFrame, leading to obscure
  21.     crashes later on. We have spent literally days tracking down problems stemming from this.
  22.     To fix this, we employ some sleight-of-hand to prevent QuickDraw.h from defining that
  23.     constant by renaming it "kQDFrameVerb". This way the compiler will properly generate a
  24.     syntax error if some schmuck forgets to declare a local "frame" variable.
  25.     
  26.     This header must be included before <QuickDraw.h>. This header is included by PlfmType.h.
  27. */
  28.  
  29.  
  30. #ifndef __QDFIX__
  31. #define __QDFIX__
  32.  
  33. #ifdef __QUICKDRAW__
  34.     #error "Yo! Please include QDFix.h before QuickDraw.h!"
  35. #else
  36.     #define frame kQDFrameVerb        // Use this instead of "frame" in QD grafProcs.
  37.     #include <QuickDraw.h>
  38.     #undef frame
  39. #endif
  40.  
  41. #endif
  42.