home *** CD-ROM | disk | FTP | other *** search
/ Media Share 13 / mediashare_13.zip / mediashare_13 / ZIPPED / PROGRAM / DDJ9403A.ZIP / XVCPP.ASC < prev   
Text File  |  1994-01-30  |  2KB  |  150 lines

  1. _CROSS-PLATFORM DEVELOPMENT WITH VISUAL C++_
  2. by Chane Cullers
  3.  
  4. Figure 1
  5.  
  6.  
  7. (a) 
  8.     
  9. file.C, line 100: error: syntax error
  10.  
  11. (b)
  12.  
  13. int  Number = 26;
  14. unsigned char Letter;
  15.  ...
  16.  
  17. Letter = unsigned char (Number);
  18.  
  19. (c)
  20.  
  21. Letter = (unsigned char)Number;
  22.  
  23.  
  24. Figure 2: 
  25.  
  26. (a)
  27.  
  28. file.C, line 100: error: WinCalApp::ExitInstance() type mismatch: 
  29. int WinCalApp::ExitInstance() and BOOL WinCalApp::ExitInstance()
  30.  
  31. (b)
  32.  
  33. BOOL WinCalApp::ExitInstance()
  34.  
  35.  
  36. (c)
  37.  
  38. int WinCalApp::ExitInstance()
  39.  
  40.  
  41. Figure 3: 
  42.    
  43.  
  44. (a)
  45. file.C, line 100: error: jump past initializer (did you forget a '{ }'?)
  46.  
  47. (b)
  48.  default:
  49.     int  Number = GetSomeNumber();
  50.     ...
  51.     Doit(Number)
  52.     
  53.  
  54. (c)
  55. default:
  56.   {
  57.     int  Number = GetSomeNumber();
  58.     ...
  59.     Doit(Number)
  60.   }
  61.   
  62.  
  63.  
  64. Figure 4: 
  65.  
  66. (a)
  67.  
  68.  
  69. file.C, line 100: error: syntax error
  70.  
  71. (b)
  72.  
  73. DECLARE_DYNAMIC(ClassName); 
  74.  
  75. (c)
  76.  
  77. DECLARE_DYNAMIC(ClassName) 
  78.  
  79.  
  80. Figure 5: 
  81.  
  82. (a)
  83.  
  84.  
  85. file.C: 100: Overflowed replacement buffer.
  86.  
  87.  
  88. (b)
  89. #define DEBUG_NEW new(__FILE__, __LINE__)
  90. #if DEBUG
  91. #define new DEBUG_NEW
  92. #endif
  93. CObject *obj = new CObject;
  94.  
  95. (c)
  96.  
  97. #define DEBUG_NEW new(__FILE__, __LINE__)
  98. #if DEBUG
  99. #define MYnew DEBUG_NEW
  100. #else
  101. #define MYnew new
  102. #endif
  103. CObject *obj = MYnew CObject;
  104.  
  105.  
  106.  
  107. Example 1: 
  108.  
  109. typedef unsigned short WORD;
  110. int function()
  111. {
  112.      WORD wOne;
  113.      int nTwo;
  114.      ...
  115.      nTwo = (WORD)wOne;
  116.      ...
  117. }
  118.  
  119.  
  120. Example 2: 
  121.  
  122.  
  123. (a)
  124.  
  125. struct tagPOINT
  126. {
  127.      short x;
  128.      short y;
  129. };
  130. class CPoint : tagPOINT {
  131.      ...
  132.      CPoint::CPoint(DWORD);
  133.      ...
  134. };
  135. CPoint::CPoint(DWORD dwPoint);
  136. {
  137.      *(DWORD *)this = dwPoint;
  138. }
  139.  
  140. (b)
  141.  
  142. CPoint::CPoint(DWORD dwPoint)
  143. {
  144.     x=LOWORD(dwPoint);
  145.     y=HIWORD(dwPoint);
  146. }
  147.  
  148.  
  149.  
  150.