C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

commenting out some no-op lines leads to wrong execution

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ Language (Moderated)
View previous topic :: View next topic  
Author Message
Guest






PostPosted: Tue Jun 27, 2006 4:29 pm    Post subject: commenting out some no-op lines leads to wrong execution Reply with quote



hi,

I'm just having a weird problem that I can't explain by myself and
would appreciate someone else's view on this piece of code (used in a
JNI project). Basically if I remove some no-op lines the compiled
library does not load the file anymore. I
suspect that this comes from an error in the compile/linking chain
but can't spot it... Has anyone already face something like that ? :

void Store::load(const string& filename){
ifstream is(filename.c_str(), ios::binary | ios::in);
DataInputStream dis(&is);
Vector v;
bool test;
while(dis>>v){
addVector(v);

//no-op!!!!!!
test=false;
}
is.close();

int i=0;

//no-op!!!!!!!
cout<<dis<<" "<<i<<" "<<" "<<endl;

}

This is compiled with gcc for cygwin with options:

-mno-cygwin -Wl,--add-stdcall-alias -shared

last thing:

The unit test for this code succeed without the no-op lines... so the
pb only occurs when linked into the real library...

cheers


[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ Language (Moderated) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.