~dcow90/myro-c++/extern-c

Viewing all changes in revision 84.

  • Committer: David Cowden
  • Date: 2011-07-01 20:34:54 UTC
  • Revision ID: cowdenda@grinnell.edu-20110701203454-aty853oonkl2b5f2
Fixed the getBright prototype so it doesn't default to a null string.
This is to address an error when compiling using extern C functions.  The g++ compilier isses an error regarding the call to the overloaded functions getBright being ambiguous.  I believe this is because the CPP Scribbler.h header lists the prototypes as follows:
std::vector<int> getBright();
and
int getBright(std::string value = ); 
Since this compiles strictly in CPP it must be an issue with the extern C compatibility.  When using extern C, the function signatures must break down both into:
std::vector<int> getBright(NULL);
and
int getBright(NULL);
These would be the same to the g++ compilier since the return type is not part of the signature.  This would cause the g++ compilier to produce the error regarding an ambiguous function getBright.  

To fix this, I changed the prototype in the Scribbler.h header to read:
int getBright(std::string value);

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: