Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 327 328 [329] 330 331 ... 796

Author Topic: if self.isCoder(): post() #Programming Thread  (Read 907893 times)

cerapa

  • Bay Watcher
  • It wont bite....unless you are the sun.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #4920 on: September 15, 2013, 01:03:30 pm »

"Armoring" was a poor example, but it doesn't work for any of the streams that use ==. strEndRead is declared in the parenthesis of the function that the loop resides in.
Streams? You mean strings?

I didn't mean its location. Is strEndRead a char array?
yes I meant strings and no it's an std::string.
In the pastebin you are still doing strcmp (strY, strEndRead).

Sadly I have no idea why == wouldn't work. What's the exact error message?
Logged

Tick, tick, tick the time goes by,
tick, tick, tick the clock blows up.

MrWillsauce

  • Bay Watcher
  • Has an ass that won't quit
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #4921 on: September 15, 2013, 01:05:48 pm »

Error: no operator "!=" matches these operands.
Logged

cerapa

  • Bay Watcher
  • It wont bite....unless you are the sun.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #4922 on: September 15, 2013, 01:08:48 pm »

Welp.
I'm out.

Perhaps you should reinstall. == with strings is kinda a standard function that really shouldn't be broken.
Logged

Tick, tick, tick the time goes by,
tick, tick, tick the clock blows up.

olemars

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #4923 on: September 15, 2013, 01:30:24 pm »

Well I can't see what. It's all there in the pastebin, so you could take a look there and see if you see anything. == won't work when comparing an std::string to a string in the file (such as "armoring") or in (strY != strEndRead). The compiler just says "no operator '==' or '!=' matches these operands."

Pastebin the whole sourcefile (or as much of it as you're comfortable with) and all the errors exactly as output by the compiler.
Logged

MrWillsauce

  • Bay Watcher
  • Has an ass that won't quit
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #4924 on: September 15, 2013, 01:37:30 pm »

http://pastebin.com/5yb3KW3W

The errors are at:
line 166, where the >> operator "matches no operands"
lines 167-212 where it can't compare strY with a string using strcmp (which as Cerapa said is expected), or compare strY to strings using == (which is a problem).
line 213 where != "does not match these operands"
Logged

da_nang

  • Bay Watcher
  • Argonian Overlord
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #4925 on: September 15, 2013, 01:46:13 pm »

All these string issues makes me value the lessons Java really drilled into me.

equals() for content comparison.
== for reference address comparison and primitive comparison (except float).
Logged
"Deliver yesterday, code today, think tomorrow."
Ceterum censeo Unionem Europaeam esse delendam.
Future supplanter of humanity.

olemars

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #4926 on: September 15, 2013, 02:14:54 pm »

http://pastebin.com/5yb3KW3W

The errors are at:
line 166, where the >> operator "matches no operands"
lines 167-212 where it can't compare strY with a string using strcmp (which as Cerapa said is expected), or compare strY to strings using == (which is a problem).
line 213 where != "does not match these operands"

Try #include <string>
Logged

MrWillsauce

  • Bay Watcher
  • Has an ass that won't quit
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #4927 on: September 15, 2013, 02:16:56 pm »

Where should I put it? At the top with iostream and stuff?
Logged

olemars

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #4928 on: September 15, 2013, 02:28:53 pm »

Yup. Also eliminate all occurences of strcmp.
Logged

MrWillsauce

  • Bay Watcher
  • Has an ass that won't quit
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #4929 on: September 15, 2013, 03:17:36 pm »

Wow, everything works now. Thanks so much!
Logged

Mephisto

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #4930 on: September 17, 2013, 09:40:53 am »

At some point in the past, my predecessor had a problem. Being titled "programmer" by the less knowledgeable meant he had several opinions on how this problem should be solved. In the end, his problem was solved using VBScript, 1- and 2-letter variable names, a complete dearth of comments, url manipulation using string splitting and concatenation, and gigantic, needlessly complex nested case statements. These are glued together using recursion.

Now I have six problems.
Logged

MagmaMcFry

  • Bay Watcher
  • [EXISTS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #4931 on: September 17, 2013, 09:46:03 am »

I guess that guy read the obfuscation manual.
Logged

Siquo

  • Bay Watcher
  • Procedurally generated
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #4932 on: September 17, 2013, 10:09:13 am »

At some point in the past, my predecessor had a problem. Being titled "programmer" by the less knowledgeable meant he had several opinions on how this problem should be solved. In the end, his problem was solved using VBScript, 1- and 2-letter variable names, a complete dearth of comments, url manipulation using string splitting and concatenation, and gigantic, needlessly complex nested case statements. These are glued together using recursion.

Now I have six problems.
Sorry.
Logged

This one thread is mine. MIIIIINE!!! And it will remain a happy, friendly, encouraging place, whether you lot like it or not. 
will rena,eme sique to sique sxds-- siquo if sucessufil
(cant spel siqou a. every speling looks wroing (hate this))

Mephisto

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #4933 on: September 17, 2013, 10:29:43 am »

I wasn't really fishing for anything.

When that big jumble was still inside my skull (in between bashing said skull against the keyboard at this exercise in futility), it sounded like one of those programmer quips you hear (you know, "I had a problem. I thought I would use regular expressions. Now I have two problems."). Thought someone might get a chuckle.
Logged

Siquo

  • Bay Watcher
  • Procedurally generated
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #4934 on: September 17, 2013, 10:32:36 am »

I chuckled, but I also know that I am guilty of having done stuff like that in the past.  :-[
Logged

This one thread is mine. MIIIIINE!!! And it will remain a happy, friendly, encouraging place, whether you lot like it or not. 
will rena,eme sique to sique sxds-- siquo if sucessufil
(cant spel siqou a. every speling looks wroing (hate this))
Pages: 1 ... 327 328 [329] 330 331 ... 796