Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Trap representation

Reply
Thread Tools

Trap representation

 
 
ramu
Guest
Posts: n/a
 
      01-31-2006
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

 
Reply With Quote
 
 
 
 
rayw
Guest
Posts: n/a
 
      01-31-2006
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*
==============


 
Reply With Quote
 
 
 
 
CBFalconer
Guest
Posts: n/a
 
      01-31-2006
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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can "all bits zero" be a trap representation for integral types? Army1987 C Programming 6 07-07-2007 12:01 PM
Trap representation Richard Tobin C Programming 10 06-22-2007 11:42 PM
trap representation junky_fellow@yahoo.co.in C Programming 6 01-13-2007 05:47 AM
trap representation pemo C Programming 11 12-14-2005 11:00 AM
trap representation Mantorok Redgormor C Programming 18 09-19-2003 04:09 PM



Advertisments