Re: time to get rid of unsigned?
From: Albert van der Horst (albert_at_spenarnc.xs4all.nl)
Date: 02/25/04
- Next message: anon luker: "Re: 'Assignable' Expression Templates?"
- Previous message: Victor Bazarov: "Re: inheritance"
- In reply to: Thomas Matthews: "Re: time to get rid of unsigned?"
- Next in thread: Dennis \(Icarus\): "Re: time to get rid of unsigned?"
- Reply: Dennis \(Icarus\): "Re: time to get rid of unsigned?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 25 Feb 2004 16:44:02 GMT
In article <7xNYb.37095$zX7.1751@newssvr33.news.prodigy.com>,
Thomas Matthews <Thomas_MatthewsHatesSpamBots@sbcglobal.net> wrote:
<SNIP?
>My current escape goat on this topic is Borland.
>They have used signed integers in their Windows
>libraries where unsigned should be used (can a
>control have a negative length?). So I am having
>to perform casts on my code to be compatible with
>their library.
Borland is right. You are wrong. See below.
>
>If I writing an application for a {lung} ventilator,
>and I need breaths per second, I cannot have a
>negative quantity, so I will use an unsigned integer.
>I don't want to have the risk of the controlling
>variable to go into negative breaths per second.
>Also, can one have a negative volume of air filled
>into the lungs (can we say implosion?).
Do you really believe that where you make a program
error that results in negative breaths, your patient
is saved by using a type unsigned?
Warn me if you write such an application, so that
I can find an other hospital.
>I also discussed that signed integers require at
>least one bit for the sign, thus loosing one bit.
Big deal.
>I'm working on an embedded system now that has
>32 sources of interrupts. Not 31, but 32. So
>we represent the register as an unsigned quantity
>so we can access all 32 bits.
Appropriate use. The reason is that you look at the raw
bits here.
>I belive that the signed and unsigned issue is one
>of discipline. If one should drop unsigned integers
>due to poor usage, then one should drop the entire
>language because it can be very obscure without
>discipline by programmers. Blame the programmers,
>not the language. Does one fault a leaning house
>on the tools or the developer?
I agree with this.
>
>--
>Thomas Matthews
>
>C++ newsgroup welcome message:
> http://www.slack.net/~shiva/welcome.txt
>C++ Faq: http://www.parashift.com/c++-faq-lite
>C Faq: http://www.eskimo.com/~scs/c-faq/top.html
>alt.comp.lang.learn.c-c++ faq:
> http://www.raos.demon.uk/acllc-c++/faq.html
>Other sites:
> http://www.josuttis.com -- C++ STL Library book
>
--
--
Albert van der Horst,Oranjestr 8,3511 RA UTRECHT,THE NETHERLANDS
One man-hour to invent,
One man-week to implement,
One lawyer-year to patent.
- Next message: anon luker: "Re: 'Assignable' Expression Templates?"
- Previous message: Victor Bazarov: "Re: inheritance"
- In reply to: Thomas Matthews: "Re: time to get rid of unsigned?"
- Next in thread: Dennis \(Icarus\): "Re: time to get rid of unsigned?"
- Reply: Dennis \(Icarus\): "Re: time to get rid of unsigned?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|