Thread: what "bitand" do ???

  1. #1
    Registered User
    Join Date
    Mar 2012
    Posts
    29

    what "bitand" do ???

    hello
    what does "bitand" do in c++ code ?


    what is that mean : (object_name bitand variable_name)

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    bitand means &

    Just another name, so unless you need it, you might as well use &.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Mar 2012
    Posts
    29
    Thank You Laserlight,

    what is that mean : (object_name bitand variable_name) ?

  4. #4
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Oh, then you should read about bit shifting and bitwise operations.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  5. #5
    Registered User
    Join Date
    Mar 2012
    Posts
    29
    What is that mean :
    class_name bitand operator = (const class_name bitant)


    Thanks laserlight

  6. #6
    Registered User
    Join Date
    Mar 2012
    Posts
    29
    But an object is not a variable ! . it is not possible to do bit wise with an object .

  7. #7
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by codewriter
    What is that mean :
    class_name bitand operator = (const class_name bitant)
    Do you have any special reason to use bitand instead of & when I already recommended just using &? Are you learning C++ through a book or something? If so, which book?

    Quote Originally Posted by codewriter
    But an object is not a variable ! . it is not possible to do bit wise with an object .
    The term "object" can include objects of built-in types like int. But you probably have objects of class type in mind, in which case there is operator overloading.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  8. #8
    Registered User
    Join Date
    Mar 2012
    Posts
    29
    This a part of the code :
    bool DrawRect(const TRect bitand SrcRect, int x, int y)

  9. #9
    Registered User
    Join Date
    Mar 2012
    Posts
    29
    TRect is a name of a class

  10. #10
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Please answer my questions.

    The problem is that this should be a fairly easy question to answer, as long as you have had a proper introduction to C++. Otherwise, my answer will be meaningless to you except as an answer to a trivia question.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  11. #11
    - - - - - - - - oogabooga's Avatar
    Join Date
    Jan 2008
    Posts
    2,808
    If bitand is exactly the same as & (whether meaning bitwise-and, address-of or reference) then
    Code:
    class_name bitand operator = (const class_name bitand)
    is just a really stupid way of saying
    Code:
    class_name& operator=(const class_name&)
    The cost of software maintenance increases with the square of the programmer's creativity. - Robert D. Bliss

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 9
    Last Post: 03-31-2009, 04:23 PM
  2. Replies: 46
    Last Post: 08-24-2007, 04:52 PM
  3. "itoa"-"_itoa" , "inp"-"_inp", Why some functions have "
    By L.O.K. in forum Windows Programming
    Replies: 5
    Last Post: 12-08-2002, 08:25 AM
  4. "CWnd"-"HWnd","CBitmap"-"HBitmap"...., What is mean by "
    By L.O.K. in forum Windows Programming
    Replies: 2
    Last Post: 12-04-2002, 07:59 AM