title: What's a macro before a function or a class in C++?
body: <p>I've seen some codes like this：</p>
  
  <pre><code>#define A // macro
  A void foo(bar); // function declaration
  </code></pre>
  
  <p>and this:</p>
  
  <pre><code>#define B // macro
  class B foo { // class declaration
    bar
  };
  </code></pre>
  
  <p>What's the meaning of using a macro there?</p>
  
  <p>Er...I mean I don't understand the grammar. I haven't seen this before.</p>
  
  <p>In fact, I just find this kind of codes in <code>features2d.hpp</code> in opencv3.1.</p>
  
  <pre><code>class CV_EXPORTS_W BOWImgDescriptorExtractor {
  ...
  CV_WRAP void setVocabulary( const Mat&amp; vocabulary );
  ...
  }
  </code></pre>
  
  <p>In cvdef.h</p>
  
  <pre><code>#if (defined WIN32 || defined _WIN32 || defined WINCE || defined __CYGWIN__) &amp;&amp; defined CVAPI_EXPORTS
  #  define CV_EXPORTS __declspec(dllexport)
  #elif defined __GNUC__ &amp;&amp; __GNUC__ &gt;= 4
  #  define CV_EXPORTS __attribute__ ((visibility ("default")))
  #else
  #  define CV_EXPORTS
  #endif
  
  /* special informative macros for wrapper generators */
  #define CV_EXPORTS_W CV_EXPORTS
  #define CV_WRAP
  </code></pre>
  
  <p>Here, CV_EXPORTS_W and CV_WRAP are macros. I haven't seen this kind of grammar in C++.</p>