bug-gmp
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: "gmp.h" & MS C


From: David T. Ashley
Subject: RE: "gmp.h" & MS C
Date: Mon, 20 Aug 2001 15:41:39 -0400

Dear Mr. Golubev,

Depending on what you want to use the GMP library for, if you go to the
following URL:

http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/ijutools/swprojs/shr_c_dd/

and get the files GMP_INTS.H and GMP_INTS.C, these will compile "clean" with
no
problems.

I "ported" the GMP library to Microsoft Visual C++, but probably in a way
which does not meet your needs.  In addition to taking care of issues like
you mentioned, I aggressively stripped everything out of the library that I
did not understand.  This means that I went back to the multiplication
basecase (who in the heck was this Karatsuba guy, anyway?), and replaced the
GCD algorithm, etc.  The end result is that the stripped down version I have
is probably MUCH slower than the GNU MP library, especially asymptotically,
but it meets my humble needs.

But, if you want just basic functionality that compiles right away, that
will do it.

On another note, I sent several e-mails to this newsgroup indicating that
the GNU MP library did not meet coding standards, etc.  What I received back
was a bunch of defensive e-mails, some to the newsgroup, and some which were
private, which were essentially statements denying the obvious.

I can only conclude that this particular group of individuals is technically
brilliant, but for some reason they don't value neatness very much.  It is
kind of like being lucky enough to get a beautiful wife who can't cook.  I
just don't know what to say.

Good luck, Dave.

-----Original Message-----
From: address@hidden [mailto:address@hidden Behalf Of
Golubev I. N.
Sent: Monday, August 20, 2001 4:51 PM
To: address@hidden
Subject: "gmp.h" & MS C


Version: 3.1.1

It is hardly practical to build gmp itself with microsoft visual C
toolkit, but building gmp clients with it may be required.  Therefore
I am not going to adapt the entire gmp to msvc, but I need "gmp.h" to
be usable with it.

Compiling vanilla "gmp.h" involves the following troubles:

1. _INC_STDIO should be used in msvc to detect that <stdio.h> is
included;

2. In most compilers defined(__STDC__) means that it is not K&R C,
features of standard C (like ## in macros) are available.  Perhaps
__STDC__ value is different depending on whether user specified strict
standard conformance or language extensions are allowed.

When compiling C in msvc, defined(__STDC__) means that microsoft C
lang extensions are disabled, strict standard conformance is
specified.  In fact, msvc always implements full-featured C, and
standard C constructs should be used.

--- gmp.h       Sun Sep 17 03:05:49 2000
+++ gmp.h       Mon Aug 20 20:34:33 2001
@@ -33,7 +33,7 @@
 #define _LONG_LONG_LIMB
 #endif

-#if (__STDC__-0) || defined (__cplusplus)
+#if (__STDC__-0) || defined (__cplusplus) || defined (_MSC_VER)
 #define __gmp_const const
 #define __gmp_signed signed
 #else
@@ -154,7 +154,7 @@
 typedef __mpq_struct *mpq_ptr;

 #ifndef _PROTO
-#if (__STDC__-0) || defined (__cplusplus)
+#if (__STDC__-0) || defined (__cplusplus) || defined (_MSC_VER)
 #define _PROTO(x) x
 #else
 #define _PROTO(x) ()
@@ -163,7 +163,7 @@

 #ifndef __MPN
 /* Really use `defined (__STDC__)' here; we want it to be true for Sun C */
-#if defined (__STDC__) || defined (__cplusplus)
+#if defined (__STDC__) || defined (__cplusplus) || defined (_MSC_VER)
 #define __MPN(x) __gmpn_##x
 #else
 #define __MPN(x) __gmpn_/**/x
@@ -172,7 +172,8 @@

 #if defined (FILE) || defined (H_STDIO) || defined (_H_STDIO) \
  || defined (_STDIO_H) || defined (_STDIO_H_) || defined (__STDIO_H__) \
- || defined (_STDIO_INCLUDED) || defined (__dj_include_stdio_h_)
+ || defined (_STDIO_INCLUDED) || defined (__dj_include_stdio_h_) \
+ || defined (_INC_STDIO)
 #define _GMP_H_HAVE_FILE 1
 #endif


_______________________________________________
Bug-gmp mailing list
address@hidden
http://mail.gnu.org/mailman/listinfo/bug-gmp




reply via email to

[Prev in Thread] Current Thread [Next in Thread]