15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


CString nondeterminism?

Andre Hinsberger -- andre.hinsberger@munich.ixos.de
Friday, December 06, 1996

Environment: Win95, VC++ 4.1

>From time to time I encounter a strange phenomenon.
Given following object instantiation:

    CMyFile myFile( "test.dat");

This constructors expects a CString, so that WE expect
the compiler to choose

   CString::CString(LPCTSTR lpsz)

for converting our string constant to a CString.
This is exactly what happens... in most cases!
Sometimes the compiler chooses

   CString::CString(TCHAR ch, int nLength)

which is usually not good at all for the running
application.

Well, it seems almost like a compiler bug to me.
But because I have this phenomenon only with
CString I've choosen this mailing list.

Any clue?

   Andr=E9 Hinsberger




Mike Blaszczak -- mikeblas@nwlink.com
Sunday, December 08, 1996

At 10:11 12/6/96 +0100, Andre Hinsberger wrote:
>Environment: Win95, VC++ 4.1

>This constructors expects a CString, so that WE expect
>the compiler to choose
>   CString::CString(LPCTSTR lpsz)

>Sometimes the compiler chooses
>   CString::CString(TCHAR ch, int nLength)

>which is usually not good at all for the running
>application.
>Well, it seems almost like a compiler bug to me.

Can you provide a reproducable case?

.B ekiM
http://www.nwlink.com/~mikeblas/
I'm afraid I've become some sort of speed freak.
These words are my own. I do not speak on behalf of Microsoft.




Roger Onslow/Newcastle/Computer Systems Australia/
Wednesday, December 11, 1996

[Mini-digest: 2 responses]

>>This constructors expects a CString, so that WE expect
>>the compiler to choose
>>   CString::CString(LPCTSTR lpsz)
>>
>>Sometimes the compiler chooses
>>   CString::CString(TCHAR ch, int nLength)
>>
>>which is usually not good at all for the running
>>application.
>>Well, it seems almost like a compiler bug to me.
>
>Can you provide a reproducable case?

We had a similar (identical?) problem where the compiler was chooing the wrong 
constructor for CString's.  This happened a few months ago and we have since 
worked around it.  I am pretty sure that we put a message onto MFC-L about it.  
I'll check with my associate who should have more info on this and will forward 
it along to you and the mfc-l list.

Roger Onslow
Software Development Manager
Quisine Division - Computer Systems Australia
Quisine Insite - Designing for the Future
http://www.compsys.com.au/QInsite.html
-----From: Andre Hinsberger 

>----------
>From: 	Mike Blaszczak[SMTP:mikeblas@nwlink.com]
>Sent: 	Montag, 9. Dezember 1996 02:38
>To: 	mfc-l@netcom.com; 'Microsoft Foundation Class Mail List'
>Subject: 	Re: CString nondeterminism?
>
>At 10:11 12/6/96 +0100, Andre Hinsberger wrote:
>>Environment: Win95, VC++ 4.1
>
>>This constructors expects a CString, so that WE expect
>>the compiler to choose
>>   CString::CString(LPCTSTR lpsz)
>
>>Sometimes the compiler chooses
>>   CString::CString(TCHAR ch, int nLength)
>
>>which is usually not good at all for the running
>>application.
>>Well, it seems almost like a compiler bug to me.
>
>Can you provide a reproducable case?
I'm sorry, no. It happens luckily only at rare occasions.
That's why I called it a nondeterminism.

My guess would be, that there is something wrong with
the precompiled headers. A "rebuild all" could probably
solve the problem. I will try it the next time.

What I'm curious about: Are there other people around,
having also encountered this problem?

Andr=E9 Hinsberger


>
>




| Вернуться в корень Архива |