Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!seismo!ut-sally!husc6!cmcl2!brl-adm!adm!Leisner.Henr@Xerox.COM
From: Leisner.Henr@Xerox.COM (marty)
Newsgroups: comp.lang.c
Subject: Re: Writing readable code (what is NULL)
Message-ID: <8249@brl-adm.ARPA>
Date: Fri, 10-Jul-87 10:26:33 EDT
Article-I.D.: brl-adm.8249
Posted: Fri Jul 10 10:26:33 1987
Date-Received: Sun, 12-Jul-87 11:44:33 EDT
Sender: news@brl-adm.ARPA
Lines: 31

>RE:  If I understand correctly, according to K&R the "usual arithmetic
>conversions" will be applied to the operands of the conditional
>operator causing the int 0 to be converted to long int 0.

I've found it is often a bad idea to assume these funny type conversions
will take place.  If it doesn't do what you expect, this is one of the
worst possible bugs to track down.

C has the power to let you do anything you want -- including shoot
yourself in the foot.

The PC memory models make life rougher for the programmer, but it also
forces you to compare apples to apples.  A lot of C code with the
implicit assumptions sizeof(char *) == sizeof(int) is very hard to port.

Also, it is bad practice to define NULL to be something memory model
dependent.  A better practice is:

#define NULL	(char *) 0

This automatically takes care of the sizeof dependencies.  This gets to
be a major issue when routines are being passed and/or return NULL.





marty
GV:  leisner.henr
NS:  martin leisner:henr801c:xerox
UUCP: martyl@rockvax.uucp