Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. what would be the proper way to use bitmasks?

what would be the proper way to use bitmasks?

Scheduled Pinned Locked Moved C / C++ / MFC
questionbeta-testingcode-review
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Byron Thomas Cullen
    wrote on last edited by
    #1

    I'd like to get some feedback from you guys about the best/proper way to use bitmasks. I've seen them used in several ways, the most common I think is to do something like #define BLAH 0x0001 So I was wondering what is the proper way to use them. I've seen people use decimal number, hex numbers, ascending, decending, short, long and the list goes on and on. So let me know what you guys think is a good strong coding practice to get into the habit of. Thanks!

    U 1 Reply Last reply
    0
    • B Byron Thomas Cullen

      I'd like to get some feedback from you guys about the best/proper way to use bitmasks. I've seen them used in several ways, the most common I think is to do something like #define BLAH 0x0001 So I was wondering what is the proper way to use them. I've seen people use decimal number, hex numbers, ascending, decending, short, long and the list goes on and on. So let me know what you guys think is a good strong coding practice to get into the habit of. Thanks!

      U Offline
      U Offline
      User 1125
      wrote on last edited by
      #2

      Whatever representation you use, they should be const variables rather than preprocessor macros. Dave

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups