SQLite Forum

Problem with Borland C 5.5.1 compilation for Windows
Login

Problem with Borland C 5.5.1 compilation for Windows

(1) By Vif Ardente (vif_ardente) on 2021-12-20 09:17:12 [link] [source]

Old Borland C compiler does not understands int64 literals defined with LL suffix.

Suggestion: use macro like INT64_C from stdint.h:

#ifdef __BORLANDC__
#define INT64_LITERAL(V) (V##i64)
#else
#define INT64_LITERAL(V) (V##LL) /* or #include <stdint.h> / #define INT64_LITERAL INT64_C */
#endif
...

SQLITE_PRIVATE int sqlite3GetUInt32(const char *z, u32 *pI){
  u64 v = 0;
  int i;
  for(i=0; sqlite3Isdigit(z[i]); i++){
    v = v*10 + z[i] - '0';
    if( v>INT64_LITERAL(4294967296) ){ *pI = 0; return 0; }
  }
  if( i==0 || z[i]!=0 ){ *pI = 0; return 0; }
  *pI = (u32)v;
  return 1;
}

There is 19 such literals in 3.37.0 amalgamation.

(2) By Max (Maxulite) on 2021-12-28 14:27:50 in reply to 1 [source]

My suggestion is to replace the constants with the syntax suitable for bcc so for example -2251799813685248LL becomes -2251799813685248i64.

I used this in semi-automated mode for several recent versions. It's better to do this with Regex-based or other tool avoiding incorrect replacements.

There was a short discussion about this incompatibility in the mail list you can find at https://www.mail-archive.com/sqlite-users