George said:
Thanks David,
I will go to the newsgroup to discuss. I am not going to rely on others and
do not do any work by myself. Acutally, I want to learn others' points why
converting from size_t to unsigned int will cause warning message -- is it a
defect in Visual Studio?
I have looked into winnt.h that size_t is actually defined to unsigned int.
This is why I have such question.
George:
As several people have pointed out to you, this must be a 64-bit
portability warning. It is not a defect in Visual Studio. You can turn
off 64-bit warnings as I described in this thread. The warnings come
because on Win64 there are size_t values that cannot be represented in
32 bits (because they are too big). This is very rarely a problem in
practice. But the best thing, if possible, is to write your code so that
it does not require conversions between integer types. Sometimes this is
not possible, such as when your code mixes CString (which uses int's)
and std::string (which uses size_t), in which case you have to cast.
I notice that you have posted another question. This new question is
about interoperability between C++ and C#. This *is* a .NET question,
and properly belongs in this group. However you have posted it both in
this group, and in microsoft.public.vc.language. This is called
multi-posting, and is a very bad practice, because the replies get
fragmented (as you will discover). Better than multi-posting is
cross-posting (if your software allows it); this is posting the same
message simultaneously to two or more groups.
But by far the best method is to pick the single most appropriate group
and just post there. If the question is about .NET (managed code) then
post here; otherwise use microsoft.public.vc.language.