On 2013/11/30 05:28, Igor Korot wrote:
As you can see from http://sqlite.org/c3ref/last_insert_rowid.html, it
returns sqlite3_int64, a signed 64-bit integer type.  The C99 name and
I think the C++11 name for this is int64_t, which is probably what
you want, but I vaguely recall the Microsoft compiler requires jumping
through some kind of hoop to get it.  You could just use sqlite3_int64
directly if you don't mind taking the header dependency.
Well, than I don't want the extra dependancy.
I have a nice application with dependancies set up correctly as it is
compiled on Windows.
And I wouldn't even know about it if it's not about Mac compilation. ;-)

My biggest problem is: why MSVC compiled this code just fine?

Also I am compiling 32-bit app on both platforms.

The fact that the app compiles is no great precursor to its success in the wild. The thing you are avoiding is not a dependancy - 64 bit types should be easy in any platform and I know Windows (anything after XP anyway) uses only 64-bit internals, much like any other OS since the dawn of the 21st century. The fact that you can still compile 32 bit programs and run it is pure backward compatibility on any system that still allow it, so if your compiler does not support it natively, you need to upgrade.

But, that is not the case... your compiler supports it just fine - it isn't a dependancy, it's a native part of the compiler, it must be. Even in older 32-bit compiling systems there's always a 64 bit LongLong or Int64 or whatever flavour it went by. The reason you might not be getting the same 32-vs-64 bit warning might be that your compiler is sneakily using 64 bit integers in the background anyway, while the other doesn't or at least, doesn't warn you about it. (This is a hypothesis, I'm not using MSVC so cannot say for sure).

Either way, you NEED to cast that return value to a proper data-type hat can hold all of 64 bits in it... else you will get errors, especially when some user of your program runs into the first >32bit number in his/her database and it turns negative, or overwrite previous keys, etc. etc.

You cannot ignore it, but it should be really easy to fix. Any MSVC buff here 
knows the exact Type for a 64b-int in MSVC?



_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to