S
shahan.am
HI..
I have a custom built String class. In that i used memcmp funtion
instead of strcmp since i have a track of length of the string.
Eg:
bool operator=(const char* pz)
{
return memcmp(buffer, pz, bufferlength + 1) == 0;
}
where 'buffer' is the actual data buffer i used to keep the string in
side my string class and bufferlength is the varible holds the length
of the string with out the null character at the end.
I compiled this in SUN solaris 5.10 with g++ compiler.
When purifying only sometimes it reports Array bound read.
Then i tried with this small program
#include <iostream>
using namespace std;
int main(int argc, const char** argv)
{
int ret = memcmp("XYZ", "ABCD_ABC_ABCDEF", 5);
cout << ret << endl;
return 0;
}
this also gives ABR warning, but when compiled with O3 option it does
NOT give the warning,..
what is the reason behind it ?
thank you all
I have a custom built String class. In that i used memcmp funtion
instead of strcmp since i have a track of length of the string.
Eg:
bool operator=(const char* pz)
{
return memcmp(buffer, pz, bufferlength + 1) == 0;
}
where 'buffer' is the actual data buffer i used to keep the string in
side my string class and bufferlength is the varible holds the length
of the string with out the null character at the end.
I compiled this in SUN solaris 5.10 with g++ compiler.
When purifying only sometimes it reports Array bound read.
Then i tried with this small program
#include <iostream>
using namespace std;
int main(int argc, const char** argv)
{
int ret = memcmp("XYZ", "ABCD_ABC_ABCDEF", 5);
cout << ret << endl;
return 0;
}
this also gives ABR warning, but when compiled with O3 option it does
NOT give the warning,..
what is the reason behind it ?
thank you all