C++ Problem
C++ Problem
- Subject: C++ Problem
- From: "Kevin McEnhill" <email@hidden>
- Date: Wed, 20 Sep 2006 21:34:54 -0500
I seem to have run into a problem with the g++ compiler. I know this
is an XCode list but because the problem followed when I went into
XCode, I feel that this is a legal post. If anyone knows a better
place to post this problem, please let me know.
The code to illustrate the problem:
-------BEGIN-------
#include <iostream>
#include <fstream>
using namespace std;
int main (int argc, char *argv[])
{
char *buff;
// int bob;
ifstream inputfile( argv[1], ios::in );
while( inputfile )
{
inputfile.getline( buff, 256 );
cout << buff << endl;
}
// bob = 5;
// cout << bob << endl;
return 0;
}
-------END-------
The program compiles and runs as is. However, if I uncomment line 9
(int bob;), it still compiles but generates a "Bus Error" when I run
it. This code works both ways on our development system at school
(some kind of Intel Linux variant). Is this something I am fscking up
in the C++ or is the compiler tripping on something?
Specifics:
MacBook
1GB RAM
Mac OS X 10.4.7
XCode 2.4
XCode IDE 759.0
XCode Core 757.0
ToolSupport 733.0
g++ 4.0.1 (build 5363)
--
Kevin McEnhill <mailto:email@hidden>
"You can have my Mac when you pry my cold dead fingers from it"
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden