What is this doing?

This is a discussion on What is this doing? within the C Programming forums, part of the General Programming Boards category; What is this doing? #define BASE_ADDR (ADDR64(ORNAND_BASE_ADDR)) Where as ADDR64 is a 16 bit hex number and ORNAND_BASE_ADDR is an ...

  1. #1
    Registered User
    Join Date
    Sep 2007
    Location
    Boston
    Posts
    25

    What is this doing?

    What is this doing?

    #define BASE_ADDR (ADDR64(ORNAND_BASE_ADDR))

    Where as ADDR64 is a 16 bit hex number and ORNAND_BASE_ADDR is an 8 bit hex number.

    I'm trying to understand the reasoning behind putting a (hexnumber(hexnumber)) format.

    Thanks

  2. #2
    Registered User
    Join Date
    Sep 2007
    Location
    Boston
    Posts
    25
    anyone?

    (hexnumber(hexnumber))

    What is this doing?

  3. #3
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,784
    I don't understand exactly what ADDR64 and ORNAND_BASE_ADDR is.
    But the var(num) syntax can be used to initialize a variable with a given value.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  4. #4
    Registered User
    Join Date
    Sep 2007
    Location
    Boston
    Posts
    25
    Quote Originally Posted by Elysia View Post
    I don't understand exactly what ADDR64 and ORNAND_BASE_ADDR is.
    But the var(num) syntax can be used to initialize a variable with a given value.
    pretend ADDR64 is macro returning a 64bit value... and ORNAND_BASE_ADDR is defined as a 32 bit hex number

  5. #5
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,784
    Then it's a macro that takes a given value and casts it to a 64-bit value.
    BASE_ADDR is just a define of a given address that is cast to a 64-bit type.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  6. #6
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,047
    It's generally considered rude to bump your threads, especially after less than half an hour has passed.

    But the var(num) syntax can be used to initialize a variable with a given value.
    Only in C++.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  7. #7
    Registered User
    Join Date
    Sep 2007
    Location
    Boston
    Posts
    25
    Quote Originally Posted by Elysia View Post
    Then it's a macro that takes a given value and casts it to a 64-bit value.
    BASE_ADDR is just a define of a given address that is cast to a 64-bit type.
    doh! thanks!

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21