Re: BSD-sfprint

From: Thomas Arp (
Date: 01/31/03

From: "Gerald Florence" <septe@EARTHLINK.NET>
> Ok, I'm using MSVC 6.0 on Windows using Win XP.  I've compiled
> Circle 3.1 and various other packages like Circle 3.1 with goodies
> and they've compiled fine.  It's when I get to the Sumomo package
> and something weird happens with the Sumomo package.  My
> MSVC 6.0 compiler bitches about the fact you can't have a long
> long structure.  I tried to fix this by copying the original bsd-sfprint
> files from the original circle-3.1 package to the sumomo package.
> No dice.

My guess is that the sumomo package uses the GNU extension of
long long int for representation of bitvectors, effectively making
64 bits available. However, since long long int is a GNU extension
this trick will not work in MSVC. If you wish to do it right, here's
a short mail-code fix:

in structs.h:
+#ifndef _MSC_VER
+typedef unsigned long long ULONGLONG;
+typedef __int64 ULONGLONG;
Change uses of 'unsigned long long' to ULONGLONG throughout the source.

in utils.h:
+ * Macros
+ */
+#ifndef _MSC_VER
+#define _LL(n) n ## LL
+#define _ULL(n) n ## ULL
+#define _LL(n) n ## I64
+#define _ULL(n) n ## UI64
+#ifndef _MSC_VER
+#define _FORMAT_LL "ll"
+#define _FORMAT_LL "I64"
Change uses of ll and ull to use the macros throughout the files:

#define PRF_SOME_BIT (1 << 35ull)
should be
#define PRF_SOME_BIT (1 << _ULL(35))

And change s(n)printf statements to use the correct format:

sprintf(buf, "test unsigned long long int : %lld  .\r\n", num);
should be
sprintf(buf, "test unsigned long long int : %" _FORMAT_LL "d  .\r\n", num);

If you don't care to make it portable, just replace
all "long long int" with "__int64" and
all "ULL" with "UI64" and
 all "LL" with "I64" and
all "%lld" with "%I64d"
After this fix you can't go back to gcc/borland, etc.

<snip of questions regarding bsd-sprintf.c>
bsd-sprintf has nothing to do with it.

MSVC and GNU are two very different implementations of a C compiler.
On the way the designers have made design choices, and this is one of


   | FAQ: |
   | Archives: |
   | Newbie List:   |

This archive was generated by hypermail 2b30 : 06/26/03 PDT