>David Bertoni wrote, >The behavior of dereferencing this pointer is undefined, and will >certainly be a problem on a platform where sizeof(unsigned int) is >smaller than sizeof(size_t). >If you really want a cast, this is the safe thing to do: >const unsigned int len = static_cast<unsigned int>(InputSize) Yeap,I agree.
-----Original Message----- From: David Bertoni [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 11, 2006 7:20 PM To: [email protected] Subject: Re: Parse a XML tree from string Tatireddy, Vinod wrote: >> alsm wrote, >> I made the changes but now when the program executes >> parser->parse(*memBufIs); an error occurs.. > typo mistake in my previuos email, casting should be from size not from input > buffer.. > unsigned int *len = reinterpret_cast<unsigned int *>(&InputSize); > The behavior of dereferencing this pointer is undefined, and will certainly be a problem on a platform where sizeof(unsigned int) is smaller than sizeof(size_t). If you really want a cast, this is the safe thing to do: const unsigned int len = static_cast<unsigned int>(InputSize); Dave
