Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

STL String issue while porting code from 32bit to 64bit

807575Jul 8 2010 — edited Jul 20 2010
I am trying to compile and run a piece of code on Solar 5.10(sparcv9). This is how the code is

#include <string>

using namespace std;

class samplestring {

public :
int getlength(){
return (header.length());
}

void calculate(){
printf("Header length is %d", getlength());
}

private:
string header;

};

#include <string>
#include <sstream>
#include <iostream>
#include "samplestring.hpp"

using namespace std;

int main()
{

samplestring sample;
sample.calculate();

return(0);
}

The above sample code works fine. But the real code in my application when trying to check the length of the string, it is returning a garbage value in 64bit where as the same code in 32bit gives me the correct value.

Can anyone help me on this.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 17 2010
Added on Jul 8 2010
17 comments
645 views