[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-ha-dev
Subject:    Re: [Linux-ha-dev] deadtime_ms etc. long vs. unsigned long
From:       Lars Marowsky-Bree <lmb () suse ! de>
Date:       2004-10-25 20:56:11
Message-ID: 20041025205611.GG3714 () marowsky-bree ! de
[Download RAW message or body]

On 2004-10-24T22:42:21, Alan Robertson <alanr@unix.sh> wrote:

> >sure.
> >but what do you need signed deadtime for?
> >and I think it was you who said "compiles without warnings on linux -
> >not negotiable" :)
> 
> Yes.  But, not with -pedantic.  I tried this flag so long ago, but zero of 
> the warnings it issued were of any potential value in finding bugs, and 
> there were so *many* of them.  So, I deliberately chose at that time to not 
> include the flag in our set of warning flags.

Actually, signed vs unsigned comparions are always a bug indeed, because
the C language does not specify what should happen, and the result of

	unsinged long a = 0;
	signed long b = -1;

	if (b < a) { }

is actually quite unspecified; if a is converted to signed, it'll likely
do what is desired, but it might as well be that b is converted to
unsigned w/underflow -> 2^32-1.

Actually I'm kind of surprised, I'd have assumed those should have been
caught already. They are definetely bugs and should be fixed on
principles.


Sincerely,
    Lars Marowsky-Brée <lmb@suse.de>

-- 
High Availability & Clustering
SUSE Labs, Research and Development
SUSE LINUX AG - A Novell company

_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic