Re: CAtlRegExp crashes with pound sign!

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: Alexander Nickolov (agnickolov_at_mvps.org)
Date: 09/14/04


Date: Tue, 14 Sep 2004 14:38:08 -0700

Ah, I didn't pay attention where needed... Yes, you are right,
the cast to size_t is the problem, not as I thought the right shift.
If one does (size_t)(WORD)(tchar_val), we get a value in the
range 0-0xffff, but that still won't be correct for non-UNICODE
builds. And IIRC "unsigned wchar_t" is simply not a valid type,
so "unsigned TCHAR" is out of question too...

-- 
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnickolov@mvps.org
MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================
"Igor Tandetnik" <itandetnik@mvps.org> wrote in message 
news:uK55y4omEHA.3396@tk2msftngp13.phx.gbl...
> "Brian Muth" <bmuth@mvps.org> wrote in message
> news:%232OMlvomEHA.2616@tk2msftngp13.phx.gbl
>> Curious...
>>
>> and size_t x = (size_t)(unsigned char)('\x80');
>>
>> works correctly
>>
>> I wonder what the C++ language police would say?
>
> It would point you to C++ standard 4.7/2: If the destination type is
> unsigned, the resulting value is the least unsigned integer congruent to
> the source integer (modulo 2^n where n is the number of bits used to
> represent the unsigned type).
>
> In particular, '\x80' == -128 == 0xFFFFFF80 (modulo 2^32)
> -- 
> With best wishes,
>    Igor Tandetnik
>
> "On two occasions, I have been asked [by members of Parliament], 'Pray,
> Mr. Babbage, if you put into the machine wrong figures, will the right
> answers come out?' I am not able to rightly apprehend the kind of
> confusion of ideas that could provoke such a question." -- Charles
> Babbage
>
> 


Relevant Pages

  • Re: CAtlRegExp crashes with pound sign!
    ... Microsoft MVP, MCSD ... "Igor Tandetnik" wrote in message ... so any character above 0x7F will cause an overflow. ... > Mr. Babbage, if you put into the machine wrong figures, will the right ...
    (microsoft.public.vc.atl)
  • Re: dll to handle timeout
    ... There's CoEnableCallCancellation/CoCancelCall in Win2K ... Microsoft MVP, MCSD ... "Igor Tandetnik" wrote in message ... >> Timeout to WAIT for calling feedback from any function/process. ...
    (microsoft.public.vc.atl)
  • Re: Reentrancy problem ???
    ... Microsoft MVP, MCSD ... "Igor Tandetnik" wrote in message ... > First the server bends over backwards to ensure the call is completed ...
    (microsoft.public.vc.atl)
  • Re: How to get authorization HTTP header from within an ActiveX co
    ... "Igor Tandetnik" wrote: ... > server responds with 401 Unauthorized code and WWW-Authenicate header, ... > request, or you can pass them as parameters to InternetConnect. ... > Mr. Babbage, if you put into the machine wrong figures, will the right ...
    (microsoft.public.win32.programmer.ole)
  • Re: ConnectionPoint with multiple parameters
    ... Microsoft MVP, MCSD ... "Igor Tandetnik" wrote in message ... > MFC IDispatch implementation does not support SAFEARRAY parameters. ... -- Charles Babbage> ...
    (microsoft.public.vc.atl)