When to use #define and const

Discussion in 'iPad Development' started by NumbLock, Nov 6, 2010.

  1. NumbLock
    Offline

    NumbLock iPad Ninja

    Joined:
    May 2, 2010
    Messages:
    2,008
    Thanks Received:
    32
    Trophy Points:
    48
    Location:
    Switzerland
    Ratings:
    +32 / 0
    Hi Devs,

    I understand that const is a statement and #define is a preprocessor directive, but when should one use one or the other?
  2. jychong
    Offline

    jychong iPF Noob

    Joined:
    Dec 18, 2010
    Messages:
    6
    Thanks Received:
    0
    Trophy Points:
    0
    Location:
    Sg
    Ratings:
    +0 / 0
    In general if you are going the C++ route and you don't need a preprocessor, const is the way to go since it is cleaner.

Share This Page