Trap representation

Discussion in 'C Programming' started by ramu, Jan 31, 2006.

  1. ramu

    ramu Guest

    Hi,
    I read the phrase " trap representation" in the topic "Union
    arrangement" in this group. Can you please tell me what do you mean by
    it?

    regards
     
    ramu, Jan 31, 2006
    #1
    1. Advertising

  2. ramu

    rayw Guest

    ramu wrote:
    > Hi,
    > I read the phrase " trap representation" in the topic "Union
    > arrangement" in this group. Can you please tell me what do you mean by
    > it?
    >
    > regards


    Hope this works ... see http://tinyurl.com/8uhx4

    --
    ==============
    *Not a pedant*
    ==============
     
    rayw, Jan 31, 2006
    #2
    1. Advertising

  3. ramu

    CBFalconer Guest

    ramu wrote:
    >
    > I read the phrase " trap representation" in the topic "Union
    > arrangement" in this group. Can you please tell me what do you
    > mean by it?


    The better systems (rare these days) can detect uninitialized or
    otherwise improper values in an object by storing a special code
    there. The hardware detects any attempt to use that code and traps
    it.

    For example, a 2's complement machine could have INT_MAX = 32767;
    INT_MIN = -32767; and reserve the bit pattern for -32768 (or
    0x8000) as a trap value. That same machine would have to be able
    to turn off the trap mechanism for any unsigned ints.

    The same machine might be able to implement 17 bit storage for
    ints, and reserve the extra bit to signal a trap representation.
    That bit would never show up in the arithmetic. That way nothing
    special would be needed to handle unsigned ints.

    A further example is ECC memory, where a set of extra bits are used
    to automatically correct any one bit errors, and detect two bit
    errors. If a method existed to write something containing a two
    bit error, that could serve as a trap representation. This would
    be an excellent way to default initialize memory, because all use
    of programatically uninitialized storage would then be detected.

    --
    "The power of the Executive to cast a man into prison without
    formulating any charge known to the law, and particularly to
    deny him the judgement of his peers, is in the highest degree
    odious and is the foundation of all totalitarian government
    whether Nazi or Communist." -- W. Churchill, Nov 21, 1943
     
    CBFalconer, Jan 31, 2006
    #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. Mantorok Redgormor

    trap representation

    Mantorok Redgormor, Sep 11, 2003, in forum: C Programming
    Replies:
    18
    Views:
    703
  2. pemo

    trap representation

    pemo, Dec 5, 2005, in forum: C Programming
    Replies:
    11
    Views:
    535
    Tim Rentsch
    Dec 14, 2005
  3. trap representation

    , Jan 12, 2007, in forum: C Programming
    Replies:
    6
    Views:
    1,580
  4. Richard Tobin

    Trap representation

    Richard Tobin, Jun 22, 2007, in forum: C Programming
    Replies:
    10
    Views:
    563
    Keith Thompson
    Jun 23, 2007
  5. Army1987
    Replies:
    6
    Views:
    336
    CBFalconer
    Jul 7, 2007
Loading...

Share This Page