Thread: Why use "_U_" instead of simple 'U'?

  1. #1
    Registered User
    Join Date
    Mar 2021

    Why use "_U_" instead of simple 'U'?


    I came across this decleration in one of the header files:

    #define RTC_MODE0_INTENSET_CMP0_Pos _U_(8)

    The process is clear to me, but being a novice programmer, my question is why one would use "_U_" to declare an unsigned integer instead of standard 'U'.

    The other question is: where this "_U_" is declared initially?

    Thanks for the help!


  2. #2
    Registered User
    Join Date
    May 2012
    Arizona, USA
    Any macro starting with an underscore is reserved for the implementation, which is what defines _U_ here.

    As for why the implementation uses _U_ instead of U, imagine what would happen if an application also defined something named U (let's just say that bad things could happen).

    I can't answer your last question directly, but I can say that _U_ is defined somewhere in the implementation's header files (is this for SAMD? If so, it'll probably be under one of the SAMD compiler include directories).

  3. #3
    Registered User
    Join Date
    Mar 2021
    Thanks christop for explaining.

    I am using PIC32CM.


Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A "Simple" Array/String Problem. "Help" ASAP needed
    By AirulFmy in forum C Programming
    Replies: 10
    Last Post: 08-19-2015, 04:30 AM
  2. Replies: 2
    Last Post: 12-08-2014, 08:12 PM
  3. Replies: 2
    Last Post: 08-19-2012, 06:15 AM
  4. "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
  5. "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

Tags for this Thread