bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #34608] comparison of unsigned expression < 0 is always false


From: Sebastian Pipping
Subject: [bug #34608] comparison of unsigned expression < 0 is always false
Date: Sun, 13 Nov 2011 20:23:10 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20100101 Firefox/7.0.1

Follow-up Comment #2, bug #34608 (project make):

Thanks for these details.  Let me propose

  #define INTEGER_TYPE_SIGNED(t) !((t) -1 > 0)

for a warning-less replacement then.  Like it?

Please re-open the bug for me, as I lack permissions to.

I used the program below with

  # gcc -Wall -Wextra main.c && ./a.out

as a test:

================================================================
#include <stdio.h>

#define INTEGER_TYPE_SIGNED(t) !((t) -1 > 0)

int main() {
        printf("signed %dn", INTEGER_TYPE_SIGNED(unsigned char));
        printf("signed %dn", INTEGER_TYPE_SIGNED(signed char));
        printf("signed %dn", INTEGER_TYPE_SIGNED(char));
        return 0;
}
================================================================


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?34608>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]