First off: I've only just looked into SQLite, and I'm impressed; it's a
great, convenient tool with a feature set that hits a sweet spot between
functionality and simplicity for a number of uses.
 
I had just one problem when using it from C++ code on Solaris with Sun's
compiler.  (I suspect one of my other compilers would diagnose it too.)
 
This patch doesn't look to be quite right against current CVS, but for
Version 3.3.10 I've made this change to sqlite.h to fix a type error
relating to linkage (which is diagnosed, though only as a warning, by
Sun CC) which is present when using sqlite.h from C++ code.  (The same
change would apparently apply to sqlite3.h.in in the CVS tree.)
 
SQLite still builds with this change; I've not been able to run the
Tcl-based test suite.
 
On a related but separate note, is there any standard that guarantees
that casting -1 to a function pointer type is reasonably portable?  My
experience is that it doesn't cause problems, but certainly it's not
portable C or C++ from the viewpoint of the language standards.  That's
a separate issue though. The portable way would be to provide a real
function for SQLITE_TRANSIENT to point to, but still have it recognized
as a special case.  Would there be any interest in a patch to make that
change?
 
Thanks for your time,
 
-- James Dennett
 
 
--- sqlite3.h.dist      Fri Jan 19 11:58:35 2007
+++ sqlite3.h   Fri Jan 19 12:00:40 2007
@@ -1186,8 +1186,9 @@
 ** the near future and that SQLite should make its own private copy of
 ** the content before returning.
 */
-#define SQLITE_STATIC      ((void(*)(void *))0)
-#define SQLITE_TRANSIENT   ((void(*)(void *))-1)
+typedef void (*sqlite3_destructor_type)(void*);
+#define SQLITE_STATIC      ((sqlite3_destructor_type)0)
+#define SQLITE_TRANSIENT   ((sqlite3_destructor_type)-1)

 /*
 ** User-defined functions invoke the following routines in order to
 
> 


-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to