Trap representation

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ramu

    #1

    Trap representation

    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

  • rayw

    #2
    Re: Trap representation

    ramu wrote:[color=blue]
    > 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[/color]

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

    --
    ==============
    *Not a pedant*
    ==============


    Comment

    • CBFalconer

      #3
      Re: Trap representation

      ramu wrote:[color=blue]
      >
      > 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?[/color]

      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


      Comment

      Working...