Re: time to get rid of unsigned?

From: Albert van der Horst (albert_at_spenarnc.xs4all.nl)
Date: 02/25/04


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.


Relevant Pages

  • Re: Borland is neglecting Delphi for Win32 badly
    ... > like the VCL was to make the MS libraries edible, ... also provided a degree of independance and evolutivity for Borland. ... D2005 has it's own UI designer for VCL apps, it's own RTL (which like the ... >> No, the market back then was dominated by Visual Cafe, which had a solid ...
    (borland.public.delphi.non-technical)
  • Re: How to get a .lib from .dll
    ... Using the Borland tools, you should first run "IMPDEF" on the DLL file ... information in it to create ".LIB" import libraries with;)... ... from Windows version to Windows version...so, ...
    (comp.lang.asm.x86)
  • Re: How to get a .lib from .dll
    ... Using the Borland tools, you should first run "IMPDEF" on the DLL file ... information in it to create ".LIB" import libraries with;)... ... from Windows version to Windows version...so, ...
    (alt.lang.asm)
  • Re: Log File Program: problems btw compilers
    ... Thomas Matthews wrote: ... I'll post this issue to a Borland newsgroup.} ... 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: ...
    (comp.lang.cpp)
  • Re: Borland is neglecting Delphi for Win32 badly
    ... the whole point of Borland libraries ... also provided a degree of independance and evolutivity for Borland. ... Java IDE market that was irrelevant for most professional work. ... And you did say that you found MFCs just as usable as VCL? ...
    (borland.public.delphi.non-technical)