div.c and other questions

Mike Loehr michael635 at adelphia.net
Tue Sep 28 18:11:30 CEST 2004


Greetings;

I inserted the code snip into a different project with different
headers,compiler settings, etc. and got this message:

error C2513: 'int' : no variable declared before '='

I've done some research and this problem has popped up before on at least
one other project and they just patched their code.
http://oss.sgi.com/archives/mbox/ogl-sample/2002-11

Other compilers besides MSVC recognize these non-ANSI extensions:
http://www.lattice.com/otherdos.htm
http://www.softools.com/scrabbit.htm
http://www.elec.uow.edu.au/mice/documents/chap10.html

There's even a GNU compiler for some platform claiming to recognize near and
far:
http://www.pls-mc.com/deliveringsolutions/maingnu.htm

It is a hold over from DOS, there's no reason for it, it doesn't apply to
x-86, etc.  Rather than lament the idiosyncrasies of MSVC, let's just agree
to change the variable name to whatever is appropriate and move on.

Mike

-----Original Message-----
From: gmp-discuss-bounces at swox.com
[mailto:gmp-discuss-bounces at swox.com]On Behalf Of Michel Bardiaux
Sent: Tuesday, September 28, 2004 10:26 AM
To: Vincent Lefevre
Cc: mpfr at loria.fr; gmp-discuss at swox.com
Subject: Re: div.c and other questions


Vincent Lefevre wrote:

> On 2004-09-28 13:50:28 +0200, Michel Bardiaux wrote:
>
>>Do you see any reason not to take this back to the list? If yes,
>>please forward this to the list.
>
>
> You sent me a private copy (I was the only one in the To|Cc headers).
> So, back to the lists...
>
>
>>* "near" and "far" have to be considered reserved as far as 'exported'
>>headers are concerned, since those headers might be included by
>>application code that also includes windows.h
>>
>>* Why MSVC++ complains when compiling div.c is still mysterious; I cant
>>look into that without knowing exactly how the OP tried to compile.
>
>
> You could try on a simple example:
>
> int test(void)
> {
>   int near = 0;
>   return near;
> }
>
> (just compile it, do not link it). Then, you can try with various
> standard headers to see which one is the problem...
>
Well, since Brian tells us the problem is only with MSVC++6, there is no
point in my trying since I have only MSVC++7 here.

--
Michel Bardiaux
Peaktime Belgium S.A.  Bd. du Souverain, 191  B-1160 Bruxelles
Tel : +32 2 790.29.41

_______________________________________________
gmp-discuss mailing list
gmp-discuss at swox.com
https://gmplib.org/mailman/listinfo/gmp-discuss



More information about the gmp-discuss mailing list