Re: CAtlRegExp crashes with pound sign!
From: Alexander Nickolov (agnickolov_at_mvps.org)
Date: 09/14/04
- Next message: Rossen Tzonev: "Accepted types for COM objects"
- Previous message: Alexander Nickolov: "Re: Independent thread fireing events in ATL Service synchronization requirements?"
- In reply to: Igor Tandetnik: "Re: CAtlRegExp crashes with pound sign!"
- Next in thread: Patty O'Dors: "Re: CAtlRegExp crashes with pound sign!"
- Reply: Patty O'Dors: "Re: CAtlRegExp crashes with pound sign!"
- Messages sorted by: [ date ] [ thread ]
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 > >
- Next message: Rossen Tzonev: "Accepted types for COM objects"
- Previous message: Alexander Nickolov: "Re: Independent thread fireing events in ATL Service synchronization requirements?"
- In reply to: Igor Tandetnik: "Re: CAtlRegExp crashes with pound sign!"
- Next in thread: Patty O'Dors: "Re: CAtlRegExp crashes with pound sign!"
- Reply: Patty O'Dors: "Re: CAtlRegExp crashes with pound sign!"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|