943,608 Members | Top Members by Rank

Ad:
You are currently viewing page 2 of this multi-page discussion thread; Jump to the first page
Dec 14th, 2008
1

Re: New Parser Generator

It's not your compiler, it's you. Also, that file you linked doesn't use fgets.

Instead of using gets, you should use fgets.

But really you should use std::string functions.
Last edited by Rashakil Fol; Dec 14th, 2008 at 8:54 pm.
Team Colleague
Reputation Points: 1133
Solved Threads: 171
Super Senior Demiposter
Rashakil Fol is offline Offline
2,478 posts
since Jun 2005
Dec 14th, 2008
0

Re: New Parser Generator

Quote ...
Paste an example where fgets is behaving buggily and I can take a look.
So I actually tested it on another computer - and gets does indeed crash it. This is one of those errors that make 0 sense. I just write them off as a bug in GCC.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
frencheneesz is offline Offline
7 posts
since Dec 2008
Dec 14th, 2008
3

Re: New Parser Generator

That's extremely dumb. Compiler errors are extremely rare, and you're not going to set one off just by using gets.
Team Colleague
Reputation Points: 1133
Solved Threads: 171
Super Senior Demiposter
Rashakil Fol is offline Offline
2,478 posts
since Jun 2005
Dec 15th, 2008
0

Re: New Parser Generator

Come on. Please don't insult me. Look, I fixed the file up at the link I had given you - sorry I was careless about leaving gets out.

http://www.uweb.ucsb.edu/~frenchenee...Calculator.cpp

That does use gets, and it doesn't work properly. I shouldn't have said "crash" - that was misleading. The string is not recognized by my parser for some reason, and it fails. Commenting out fgets, and using my code makes it work. I don't believe there is any logical error. This is why I assumed something was wrong with the compiler.
Quote ...
Instead of using gets, you should use fgets.
Why? I would be very surprised if 'gets' didn't use 'fgets' under the covers.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
frencheneesz is offline Offline
7 posts
since Dec 2008
Dec 15th, 2008
0

Re: New Parser Generator

Just to clarify, no offense, but I'm not actually looking for critique of my programming style. Much of this code was slapped together - I am not attempting to push it as the best example of C++ code.
Last edited by frencheneesz; Dec 15th, 2008 at 12:56 am.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
frencheneesz is offline Offline
7 posts
since Dec 2008
Dec 15th, 2008
2

Re: New Parser Generator

I'll post an example of what I would consider to be a more comfortable C++ parser generator at this level of scope later tonight.
Er, tomorrow night.
Team Colleague
Reputation Points: 1133
Solved Threads: 171
Super Senior Demiposter
Rashakil Fol is offline Offline
2,478 posts
since Jun 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Computer Science Forum Timeline: flowchart done needs help ...take a look
Next Thread in Computer Science Forum Timeline: I need some tips on creating a flowchart.





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC