[Monetdb-developers] Signed/unsigned and NULL

Stefan Manegold Stefan.Manegold at cwi.nl
Tue Oct 24 10:33:48 CEST 2006


Just try with both

void myfunc(unsigned char *s) {

and

void myfunc(signed char *s) {

and you find out, whether you compiler be default defines char as signed or
unsigned (and whether your systems/compilers header files define NULL as
signed or unsigend) ;-)

Stefan


On Tue, Oct 24, 2006 at 10:16:11AM +0200, Fabian Groffen wrote:
> I just figured that the following yields in a signed/unsigned warning:
> 
>  1  void myfunc(char *s) {
>  2   if (s != NULL) {
>  3      ...
>  4    }
>  5  }
> 
> The error occurs on line 2.  I cannot find the definition of NULL, but I
> suspect it is defined like:
> #define NULL 0
> 
> Obviously 0 is signed while s (pointer) is not.  Maybe we should use
> #define NULL (char*)0
> instead?
> 
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Monetdb-developers mailing list
> Monetdb-developers at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/monetdb-developers
> 
> 

-- 
| Dr. Stefan Manegold | mailto:Stefan.Manegold at cwi.nl |
| CWI,  P.O.Box 94079 | http://www.cwi.nl/~manegold/  |
| 1090 GB Amsterdam   | Tel.: +31 (20) 592-4212       |
| The Netherlands     | Fax : +31 (20) 592-4312       |




More information about the developers-list mailing list