Author Message

Hi

I am new to programming. Could some one please explain how the
"high-order" bit in a signed integer decides if the INT is +ve/-ve. The
explanation in a book I've been reading "C: The Complete Reference - 4th
Ed" by Herbert Schildt is very limited.

Any guidance would be greatly appreciated
--
Lots of Luck

theN

Thu, 11 Nov 2004 07:08:13 GMT

Quote:

> Hi

> I am new to programming. Could some one please explain how the
> "high-order" bit in a signed integer decides if the INT is +ve/-ve. The
> explanation in a book I've been reading "C: The Complete Reference - 4th
> Ed" by Herbert Schildt is very limited.

> Any guidance would be greatly appreciated

1.  Why do you care?

2.  I'm not sure the C standard has anything to say about the representation
of the sign bit for integral types.  So, bit-twiddling with anything other
than unsigned types is likely to require some knowledge of the platform's
representation of such types.  See ones-complement vs. twos-complement and
byte order issues.

Thu, 11 Nov 2004 07:58:32 GMT
Quote:

> Hi

> I am new to programming. Could some one please explain how the
> "high-order" bit in a signed integer decides if the INT is +ve/-ve. The
> explanation in a book I've been reading "C: The Complete Reference - 4th
> Ed" by Herbert Schildt is very limited.

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Quote:
> Any guidance would be greatly appreciated

Do yourself a favour and don't ever read any book written by Herbert
Schildt.

Thu, 11 Nov 2004 08:58:48 GMT

Quote:
theN writes:
> I am new to programming. Could some one please explain how the
> "high-order" bit in a signed integer decides if the INT is +ve/-ve. The
> explanation in a book I've been reading "C: The Complete Reference - 4th
> Ed" by Herbert Schildt is very limited.

Most modern computers use a form called "two's complement" to represent
signed numbers.  Here is a fairly nice write up which explains the key
differences between that form and its competitor, one's complement.  I don't
think there is much there on the theoretical base but there is almost surely
something available on the net if you have a little patience.

http://webster.commnet.edu/roger/binary%20number%20section/bin1-5.htm

Note that nine's complement and ten's complement can be used with decimal
numbers.

Thu, 11 Nov 2004 11:10:41 GMT

Quote:
>     representation of such types.  See ones-complement vs. twos-complement
and
>     byte order issues.

to-the-point, so I thought you would be the right person to ask).

Thu, 11 Nov 2004 09:41:52 GMT

Quote:
>>     representation of such types.  See ones-complement vs. twos-complement
> and
>>     byte order issues.

> to-the-point, so I thought you would be the right person to ask).

Others may be in a better position to argue the merits of one vs. the other.

Thu, 11 Nov 2004 10:08:52 GMT

Quote:

> I am new to programming. Could some one please explain how the
> "high-order" bit in a signed integer decides if the INT is
> +ve/-ve. The explanation in a book I've been reading "C: The
> Complete Reference - 4th Ed" by Herbert Schildt is very limited.

Get another book.  There are reasons he is known as bull-shildt.

--

Available for consulting/temporary embedded and systems.

Thu, 11 Nov 2004 10:42:10 GMT

Quote:

> Do yourself a favour and don't ever read any book written by Herbert
> Schildt.

Really?  I've found his books quite useful.  Granted, not as learn-to
books, but as reference books.

-Alex

Fri, 12 Nov 2004 06:45:42 GMT

Quote:

>> Do yourself a favour and don't ever read any book written by Herbert
>> Schildt.

> Really?  I've found his books quite useful.  Granted, not as learn-to
> books, but as reference books.

> -Alex

Thanks all for the help and guidance.

I do have a simple request though - I would be very grateful if some one
suggested a good book, instead of simply saying that Herbert Schildt is
not good.

I thank once again all those who've taken time to respond.

--
Lots of Luck

theN

Fri, 12 Nov 2004 07:07:08 GMT

Quote:
>I do have a simple request though - I would be very grateful if some one
>suggested a good book, instead of simply saying that Herbert Schildt is
>not good.

Richard Heathfield's site http://users.powernet.co.uk/eton/ and Billy
Chambless regular "welcome" posting here both have some
recommendations, as does ACCU's website I think - Lawrence do you
maintain that?

--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>

Fri, 12 Nov 2004 07:28:50 GMT

Quote:

> >I do have a simple request though - I would be very grateful if some one
> >suggested a good book, instead of simply saying that Herbert Schildt is
> >not good.

> Richard Heathfield's site http://users.powernet.co.uk/eton/

Specifically, http://users.powernet.co.uk/eton/clc/cbooks.html

Quote:
> and Billy
> Chambless regular "welcome" posting here both have some
> recommendations, as does ACCU's website I think - Lawrence do you
> maintain that?

ITYM Francis Glassborow.

--

"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K&R answers, C books, etc: http://users.powernet.co.uk/eton

Fri, 12 Nov 2004 13:06:05 GMT

Quote:
>I do have a simple request though - I would be very grateful if some one
>suggested a good book, instead of simply saying that Herbert Schildt is
>not good.

K&R2.  See the References section of the FAQ for details.

Dan
--
Dan Pop
DESY Zeuthen, RZ group

Fri, 12 Nov 2004 21:21:53 GMT
On Mon, 27 May 2002 06:06:05 +0100, Richard Heathfield

Quote:

>> and Billy
>> Chambless regular "welcome" posting here both have some
>> recommendations, as does ACCU's website I think - Lawrence do you
>> maintain that?

>ITYM Francis Glassborow.

You're quite right - sorry Francis.
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>

Sat, 13 Nov 2004 05:28:16 GMT

 Page 1 of 1 [ 13 post ]

Relevant Pages