From: david.brown@hesbynett.no   
      
   On 05/02/2026 00:52, Bart wrote:   
   > On 04/02/2026 23:39, Keith Thompson wrote:   
   >> Bart writes:   
   >> [...]   
   >>> The problem is that C expects an exact format-code when trying to use   
   >>> *printf functions, and for that you need to know the exact types of   
   >>> the expressions being passed. For example:   
   >>>   
   >>> uintptr_t x; // from above   
   examples   
   >>> double y; //   
   >>> printf("x * y is %?", x * y); // What's '?'   
   >>   
   >> Since you asked...   
   >>   
   >> '?' is 'f' (or 'g' or 'e', or 'a', or any of those in upper case).   
   >> `x * y` is of type double.   
   >   
   > The 'from above examples' applies to both x and y. That means that   
   > 'double' /may/ have been redefined like this (from my post):   
   >   
   > #ifdef SQLITE_OMIT_FLOATING_POINT   
   > # define double sqlite3_int64   
   > #endif   
   >   
   > I don't know what 'sqlite3_int64' is, but it sounds like a signed integer.   
   >   
   > I was asked to give examples of conditional types, and thought it best   
   > to do so from actual programs.   
      
   What you have found is an idiocy in SQLITE, not a problem in the C   
   language or printf. If the macro "SQLITE_OMIT_FLOATING_POINT" is   
   defined, then the type named "sqlite3_int64" is not an integer type, nor   
   can it hold arbitrary 64-bit integers (as Michael S pointed out, and I   
   assume accurately, it can hold 53 bit integers). I do not know what   
   this type is used for in the code, but something like "sqlite3_bignum"   
   would be a far better choice of name. And if it is intended that people   
   print out these values directly, defining "PRsqlite3_bignum" to "%g" or   
   "%llu" as appropriate would be helpful. (Yes, the resulting printf   
   statements would be ugly - better ugly and correct than wrong).   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|