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. Advertising

  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. Advertising

  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. Advertising

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:
    2,595
    Brad Smallridge
    Nov 18, 2004
  2. Taras_96

    Variable 'variable lengths'

    Taras_96, May 8, 2005, in forum: VHDL
    Replies:
    2
    Views:
    504
    Taras_96
    May 9, 2005
  3. weijun
    Replies:
    4
    Views:
    625
  4. mfglinux
    Replies:
    11
    Views:
    724
    Roberto Bonvallet
    Sep 12, 2007
  5. David Filmer
    Replies:
    19
    Views:
    256
    Kevin Collins
    May 21, 2004
Loading...

Share This Page