title: mex file: compilation fails with with "//" comment; but compiles fine when used "/* */"
body: <p>I am writing a mex file linking C code to matlab.</p>
  
  <p>Here is my simple mex file which does not do anything and compiles fine.</p>
  
  <pre><code>#include "mex.h"
  
  #ifndef N
  #define N 100
  #endif
  
  void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
  {
      /*validate input/output arguments */
  
  }
  </code></pre>
  
  <p>But if I change the comment, like this:</p>
  
  <pre><code>#include "mex.h"
  
  #ifndef N
  #define N 100
  #endif
  
  void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
  {
      //validate input/output arguments
  
  }
  </code></pre>
  
  <p>then I get the following error:</p>
  
  <pre><code>&gt;&gt; mex mexcallingmatlab.c
  Building with 'gcc'.
  Warning: You are using gcc version '4.8.2'. The version of gcc is not supported. The version currently supported with MEX is '4.7.x'. For a list of currently supported
  compilers see: http://www.mathworks.com/support/compilers/current_release. 
  Warning: You are using gcc version '4.8.2-19ubuntu1)'. The version of gcc is not supported. The version currently supported with MEX is '4.7.x'. For a list of currently
  supported compilers see: http://www.mathworks.com/support/compilers/current_release. 
  Error using mex
  /home/dkumar/Mex_Codes_DKU/Mex_C_Codes_DKU2/mexcallingmatlab.c: In function ‘mexFunction’:
  /home/dkumar/Mex_Codes_DKU/Mex_C_Codes_DKU2/mexcallingmatlab.c:9:5: error: expected expression before ‘/’ token
       // validate input/output arguments */
  
       ^
  </code></pre>
  
  <p>Also, if I save either of the file as C++ file, then it always compiles whether I use // or /* .... */.</p>
  
  <p>Could someone please tell me why "//" is not working for commenting?</p>