Hi Roger
While I broadly agree that SQLite is 32-bit software, I do not
understand why there is an assert towards the end of
sqlite3_initialize() that fails on a 32-bit platform if SQLITE_DEBUG is
defined (code taken from SQLite 3.6.23.1):
/* The following is just a sanity check to make sure SQLite has
** been compiled correctly. It is important to run this code, but
** we don't want to run it too often and soak up CPU cycles for no
** reason. So we run it once during initialization.
*/
#ifndef NDEBUG
#ifndef SQLITE_OMIT_FLOATING_POINT
/* This section of code's only "output" is via assert() statements. */
if ( rc==SQLITE_OK ){
u64 x = (((u64)1)<<63)-1;
double y;
assert(sizeof(x)==8); /* <- FAILS ON 32-BIT PLATFORM, NO
64-BIT TYPE AVAILABLE */
assert(sizeof(x)==sizeof(y));
memcpy(&y, &x, 8);
assert( sqlite3IsNaN(y) );
}
#endif
#endif
Am I missing something here? I define SQLITE_INT64_TYPE as long in order
to compile.
Cheers,
Dave.
-----Original Message-----
From: Roger Binns [mailto:[email protected]]
Sent: Friday, September 03, 2010 7:05 AM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] 64 bit soft heap limit feature request
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 09/03/2010 02:26 AM, Mark Spychalla wrote:
> Having the option of using a value beyond 2GB would be
> useful for these newer systems for the very same reasons that having a
> soft heap limit of up to half the RAM on a system was useful on older
> systems that only supported 4GB of memory.
SQLite is pretty much 32 bit software, although it does work correctly
on 64 bit platforms and with large files. This is because there are
many APIs where 'int' (32 bit on almost all 32 and 64 bit platforms) is
used. size_t/ssize_t should have been used, although there may have
been some platforms early in SQLite's life that did not define it.
The API cannot simply be changed since that would would result in binary
incompatibility - something that can only be done for SQLite 4. Every
relevant API could be version bumped (eg added a v2/v3 suffix) although
that will be fairly messy.
Or you could just live with it. There is a 'Lite' in the name for a
reason :-)
I did do a survey of open source code when this issue was discussed
before and every example I found behaved as though the SQLite APIs took
size_t and not int. A smarter cracker than me may figure out how to
exploit that.
Roger
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAkyBAGwACgkQmOOfHg372QRtLACfUkDkxhGD1RC6GihdWBSrzoIM
SUAAnjnlpu890zp5+h8jOV1Yrz5Pr6i+
=tep2
-----END PGP SIGNATURE-----
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users