On Sun, May 08, 2011 at 12:50:31PM +0200, Jan Berger scratched on the wall:

> I am new to sqlite3 and just downloaded the code trying to test it from a
> C++ application using Visual Studio 2010. I just created a class and
> included the sqlite3.c and sqlite3.h from amalgamation-3070602 directly.
> 
> The header compiles fine, but on the sqlite3.c I get typecast errors. This
> is because my compiler is set to a high warning level and sqlite3 code does
> things like converting from void* to struct pointers. 
> 
> Is there any way I can get around this without lowering the compiler's
> warning level?

  Use the correct compiler.  SQLite is a C program and should be
  compiled with a C compiler.  In C, you are allowed to assign to/from
  a void* without an explicit cast.  That is the whole point of the 
  "void*" type.  Automatic casting is not supported in C++, however.
  There are strong arguments that allowing the automatic cast
  provides better type safety, but that's a different discussion.

  In most default setups, Visual Studio insists on compiling .c files
  with the C++ compiler, even though-- as this very example points
  out-- the languages are different enough that this behavior seems
  questionable.

  If you are sure then project is configured to use the correct C-only
  compiler, then the warnings being thrown are bogus, and I'd suggest
  you turn them off.  Phantom warnings are not useful.

   -j

-- 
Jay A. Kreibich < J A Y  @  K R E I B I.C H >

"Intelligence is like underwear: it is important that you have it,
 but showing it to the wrong people has the tendency to make them
 feel uncomfortable." -- Angela Johnson
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to