>can somebody tell me is there a problem in it ?
Assuming boolean is a typedef, there's nothing syntactically or semantically wrong with that function. Perhaps if you told us what it's supposed to do, we can tell you if it actually does it.
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
Your analysis is correct.
But whether there is anything 'wrong' depends on what it's supposed to do.
If for example is was a test to see if a number was >= 8, then it would fail miserably on negative numbers.
The name 'new' certainly doesn't help.
Salem
Posting Sage
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953
True.
So what's the indented function then?
If we don't know what it's supposed to do, how can we say whether it's right or wrong?
Salem
Posting Sage
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953
So knowing what it does, you can write a spec which means there isn't a problem, or you can write a different spec where there is a problem.
I suppose pedantically, the parameter should be unsigned, if you're messing around with bits.
Salem
Posting Sage
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953
How about using code tags?
Salem
Posting Sage
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953
mitrmkar
Posting Virtuoso
1,809 posts since Nov 2007
Reputation Points: 1,105
Solved Threads: 395
Salem
Posting Sage
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953