Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

syntax of boolean

syntax bool

  • Please log in to reply
2 replies to this topic

#1 jaiii

jaiii

    CC Regular

  • Just Joined
  • PipPipPip
  • 45 posts

Posted 28 June 2010 - 01:18 AM

Hi,
Know enybody what mean this syntax ?
bool x = (1 <62> 2); // >
bool x = (1 <60> 2); // <
if I compilig this expresion I get no errors but I get allways result false ?

Thank.
  • 0

#2 Alexander

Alexander

    YOL9

  • Moderator
  • 3963 posts
  • Location:Vancouver, Eh! Cleverness: 200
  • Programming Language:C, C++, PHP, Assembly

Posted 28 June 2010 - 01:25 AM

How did you compile that without an warning? That syntax has no mathematical value, the compiler should warn about it.

x < y > z has no meaning, only (x < y) > z, but you meant (x < z && z > x)
  • 0

All new problems require investigation, and so if errors are problems, try to learn as much as you can and report back.


#3 abzero

abzero

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 205 posts

Posted 28 June 2010 - 01:28 AM

The expressions are being parsed as two inequilties.

So it's parsed as (1<62)>2, this gives you (1)>2 or false. For instance you can do this, 1<2<3<4<5<6<7>0 and it will give you true.
  • 0





Also tagged with one or more of these keywords: syntax, bool

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download