Thread: what does this line of code do?

  1. #1

    what does this line of code do?

    What does this line of code do?
    #define	FL_FLY	(1<<0);
    I'm just not sure what the << is for. If you are wondering its from a game engine, I don't know if that is relevant or not.
    Last edited by Shadow12345; 08-03-2002 at 07:39 PM.

  2. #2
    Has a Masters in B.S.
    Join Date
    Aug 2001
    >#define FL_FLY (1<<0);

    defines FL_FLY as 1

    the simi colon shouldn't be there though, it could lead to problems, and things like this

    int p = FL_FLY
    note the lack of a semi colon, this makes the code less readable, and more confusing

    and printf("%d", FL_FLY); // is illegal because of the semi colon in the define

    the '<<' shifts the bits to the left the specified number of times in this case '0'.
    do a search for 'bit manipulation', or 'bit shifting', ect...
    ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.

  3. #3
    Registered User rmullen3's Avatar
    Join Date
    Nov 2001
    And >> is for right shifting, ~ for negation, ^ for xor, & for and, | for or'ing... etc

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C code line, pointer declaration
    By Dedalus in forum C Programming
    Replies: 2
    Last Post: 06-10-2009, 04:34 AM
  2. help again with scrolling without wrapping
    By Dukefrukem in forum C Programming
    Replies: 8
    Last Post: 09-21-2007, 12:48 PM
  3. Can't figure out a line of code...
    By bamera in forum C++ Programming
    Replies: 1
    Last Post: 10-15-2005, 07:11 PM
  4. SSCANF help
    By mattz in forum C Programming
    Replies: 7
    Last Post: 12-10-2001, 04:53 PM