Thread: Re: [PATCHES] Patch for VS.Net 2005's strxfrm() bug

Re: [PATCHES] Patch for VS.Net 2005's strxfrm() bug

From
Tom Lane
Date:
"William ZHANG" <uniware@zedware.org> writes:
> When I tried to compile pgsql-8.2devel with VS.Net 2005 and do regression
> tests,
> I found the problem. It's a bug inVS.Net 2005:
> http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=99694

So why don't you use the fixed version of VS?

            regards, tom lane

Re: [PATCHES] Patch for VS.Net 2005's strxfrm() bug

From
"Hiroshi Saito"
Date:
Hi.

"William ZHANG" <uniware@zedware.org> wrote in message news:ea5fm1$2q6i$1@news.hub.org...
> When I tried to compile pgsql-8.2devel with VS.Net 2005 and do regression
> tests,
> I found the problem. It's a bug inVS.Net 2005:
> http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=99694
>

+   /* http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=99694 */
+ #if _MSC_VER == 1400
+   {
+    char x[1];
+
+    xfrmlen = strxfrm(x, val, 0);
+   }
+ #else
    xfrmlen = strxfrm(NULL, val, 0);
+ #endif


Hmm, It seems to be the bug of very unpleasant Microsoft.:D
I think that the following is desirable as an evasion measure to add.

#if defined(_MSC_VER) && _MSC_VER == 1400

To be sure, it was only VS2005.

Regards,
Hiroshi Saito


Re: [PATCHES] Patch for VS.Net 2005's strxfrm() bug

From
Andrew Dunstan
Date:
Hiroshi Saito wrote:
> Hmm, It seems to be the bug of very unpleasant Microsoft.:D
> I think that the following is desirable as an evasion measure to add.
>
> #if defined(_MSC_VER) && _MSC_VER == 1400
>
> To be sure, it was only VS2005.
>


Why is this better than:

  #if _MSC_VER == 1400


Surely this will not be true if _MSC_VER is undefined?

cheers

andrew




Re: [PATCHES] Patch for VS.Net 2005's strxfrm() bug

From
"Hiroshi Saito"
Date:
From: "Andrew Dunstan"

> Hiroshi Saito wrote:
> > Hmm, It seems to be the bug of very unpleasant Microsoft.:D
> > I think that the following is desirable as an evasion measure to add.
> >
> > #if defined(_MSC_VER) && _MSC_VER == 1400
> >
> > To be sure, it was only VS2005.
> >
>
>
> Why is this better than:
>
>   #if _MSC_VER == 1400
>
>
> Surely this will not be true if _MSC_VER is undefined?

I experienced injustice and the reason of in OSX for it.

Regards,
Hiroshi Saito


Re: [PATCHES] Patch for VS.Net 2005's strxfrm() bug

From
Bruce Momjian
Date:
Hiroshi Saito wrote:
> From: "Andrew Dunstan"
>
> > Hiroshi Saito wrote:
> > > Hmm, It seems to be the bug of very unpleasant Microsoft.:D
> > > I think that the following is desirable as an evasion measure to add.
> > >
> > > #if defined(_MSC_VER) && _MSC_VER == 1400
> > >
> > > To be sure, it was only VS2005.
> > >
> >
> >
> > Why is this better than:
> >
> >   #if _MSC_VER == 1400
> >
> >
> > Surely this will not be true if _MSC_VER is undefined?
>
> I experienced injustice and the reason of in OSX for it.

What was the problem with OSX?  Did it throw a warning of you did an
equality test on an undefined symbol?

--
  Bruce Momjian   bruce@momjian.us
  EnterpriseDB    http://www.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

Re: [PATCHES] Patch for VS.Net 2005's strxfrm() bug

From
"Florian G. Pflug"
Date:
Bruce Momjian wrote:
>>> Why is this better than:
>>>
>>>   #if _MSC_VER == 1400
>>>
>>>
>>> Surely this will not be true if _MSC_VER is undefined?
>> I experienced injustice and the reason of in OSX for it.
>
> What was the problem with OSX?  Did it throw a warning of you did an
> equality test on an undefined symbol?

The following if evaluated to true on osx, although I'm pretty sure that
_MSC_VER isn't defined on osx ;-)
#if (_MSC_VER < 1300)
...
#endif

replacing it with
#ifdef WIN32
#if (_MSC_VER < 1300)
...
#endif
#endif

fixed the problem.

greetings, Florian Pflug



Re: [PATCHES] Patch for VS.Net 2005's strxfrm() bug

From
andrew@dunslane.net
Date:
> Bruce Momjian wrote:
>>>> Why is this better than:
>>>>
>>>>   #if _MSC_VER == 1400
>>>>
>>>>
>>>> Surely this will not be true if _MSC_VER is undefined?
>>> I experienced injustice and the reason of in OSX for it.
>>
>> What was the problem with OSX?  Did it throw a warning of you did an
>> equality test on an undefined symbol?
>
> The following if evaluated to true on osx, although I'm pretty sure that
> _MSC_VER isn't defined on osx ;-)
> #if (_MSC_VER < 1300)
> ...
> #endif
>
> replacing it with
> #ifdef WIN32
> #if (_MSC_VER < 1300)
> ...
> #endif
> #endif
>
> fixed the problem.
>


No doubt, but that's quite a different test.

cheers

andrew



Re: [PATCHES] Patch for VS.Net 2005's strxfrm() bug

From
"Florian G. Pflug"
Date:
andrew@dunslane.net wrote:
>> Bruce Momjian wrote:
>>>>> Why is this better than:
>>>>>
>>>>>   #if _MSC_VER == 1400
>>>>>
>>>>> Surely this will not be true if _MSC_VER is undefined?
>>>> I experienced injustice and the reason of in OSX for it.
>>> What was the problem with OSX?  Did it throw a warning of you did an
>>> equality test on an undefined symbol?
>> The following if evaluated to true on osx, although I'm pretty sure that
>> _MSC_VER isn't defined on osx ;-)
>> #if (_MSC_VER < 1300)
>> ...
>> #endif
>>
>> replacing it with
>> #ifdef WIN32
>> #if (_MSC_VER < 1300)
>> ...
>> #endif
>> #endif
>>
>> fixed the problem.
>
> No doubt, but that's quite a different test.
I mainly posted this to show what the offending ifdef in pgadmin3 looked like,
since someone referenced it, not as an argument against "#if _MSC_VER = 1400".

I guess "_MSC_VER < 1300" gets interpreted as "0 < 1300" if _MSC_VER is undefined,
so "_MSC_VER = 1400" would actually work.

But it still suprised me a lot that "_MSC_VER < 1300" evaluated to true if _MSC_VER
is undefined - maybe thats the _real_ reason why some people don't like the tri-state
logic in sql - it's because they get confused when trying to use the c preprocessor ;-)

greetings, Florian Pflug


Re: [PATCHES] Patch for VS.Net 2005's strxfrm() bug

From
"Hiroshi Saito"
Date:
From: "Florian G. Pflug"

Ahhhhhhh, It is right.!
I was retracing my memory for what situations the contents were.
I was in distraction.....It seems that it is satisfactory at the reason for ==.

Sorry and Thanks.!!

Regards,
Hiroshi Saito

> Bruce Momjian wrote:
>>>> Why is this better than:
>>>>
>>>>   #if _MSC_VER == 1400
>>>>
>>>>
>>>> Surely this will not be true if _MSC_VER is undefined?
>>> I experienced injustice and the reason of in OSX for it.
>>
>> What was the problem with OSX?  Did it throw a warning of you did an
>> equality test on an undefined symbol?
>
> The following if evaluated to true on osx, although I'm pretty sure that
> _MSC_VER isn't defined on osx ;-)
> #if (_MSC_VER < 1300)
> ...
> #endif
>
> replacing it with
> #ifdef WIN32
> #if (_MSC_VER < 1300)
> ...
> #endif
> #endif
>
> fixed the problem.
>
> greetings, Florian Pflug