verifycation of registed variable

Discussion in 'C Programming' started by orium69@gmail.com, Nov 9, 2005.

  1. Guest

    hi everyone, i'm wondering if there is a way to have sure that a
    variable is allocated in the cache, after its declaration with
    "register"? Tks!
     
    , Nov 9, 2005
    #1
    1. Advertisements

  2. pete Guest

    wrote:
    >
    > hi everyone, i'm wondering if there is a way to have sure that a
    > variable is allocated in the cache, after its declaration with
    > "register"? Tks!


    No.
    The one and only guaranteed effect of the register keyword,
    is that the address of a register classed object
    can't be determined by the program.

    --
    pete
     
    pete, Nov 9, 2005
    #2
    1. Advertisements

  3. writes:
    > hi everyone, i'm wondering if there is a way to have sure that a
    > variable is allocated in the cache, after its declaration with
    > "register"? Tks!


    Not in standard C, and not using any extension I've ever heard of.

    You posted the same question twice, with different subject headers,
    about 6 minutes apart. Please don't do that.

    Typically the compiler is the best judge of whether a variable should
    be in a register, and interfering with its judgement with the
    "register" keyword can be counterproductive.

    Cache is something else; it's typically managed at execution time by
    the hardware and/or the operating system. The whole point of cache is
    that it looks like ordinary memory, except that it's faster. If the
    compiler obeys the "register" keyword, the variable will be in a
    register, *not* in cache.

    Just what are you trying to accomplish?

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
    We must do something. This is something. Therefore, we must do this.
     
    Keith Thompson, Nov 9, 2005
    #3
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Brad Smallridge
    Replies:
    2
    Views:
    4,215
    Brad Smallridge
    Nov 18, 2004
  2. Taras_96

    Variable 'variable lengths'

    Taras_96, May 8, 2005, in forum: VHDL
    Replies:
    2
    Views:
    599
    Taras_96
    May 9, 2005
  3. weijun
    Replies:
    4
    Views:
    718
  4. KathyB
    Replies:
    1
    Views:
    511
  5. John Kraft

    Shared Variable Vs. Session Variable

    John Kraft, Oct 21, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    2,029
    Cowboy \(Gregory A. Beamer\)
    Oct 21, 2003
  6. THY
    Replies:
    3
    Views:
    596
    Radderz
    Sep 4, 2006
  7. mfglinux
    Replies:
    11
    Views:
    974
    Roberto Bonvallet
    Sep 12, 2007
  8. David Filmer
    Replies:
    19
    Views:
    518
    Kevin Collins
    May 21, 2004
Loading...