zsh-workers
 help / color / mirror / code / Atom feed
* Re: 0 vs. NULL (RE: Worrisome warnings after recent patches)
@ 1999-03-04 10:42 Sven Wischnowsky
  0 siblings, 0 replies; 4+ messages in thread
From: Sven Wischnowsky @ 1999-03-04 10:42 UTC (permalink / raw)
  To: zsh-workers


Bruce Stephens wrote:

> Bernd Eggink <eggink@uni-hamburg.de> writes:
> 
> > Andrej Borsenkow wrote:
> 
> > > What is the point of using NULL to initialize null pointer. The only
> > > portable and official way is to use `0'(zero), that is garanteed to be
> > > converted to whatever representation null pointer has on a given system.
> > 
> > No, this applies to C++ only, not to C. In C you should use the NULL
> > macro or (void*)0.
> 
> There's an issue with arguments to functions which don't have
> prototypes, but apart from that, the literal 0 as a pointer should be
> fine in C.

Since the original message was a reaction to my patch: I know that `0' 
should be fine in C (at least with modern compilers) and personally I
prefer it. But using `NULL' is the convention used throughout the zsh
code, so...

Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: 0 vs. NULL (RE: Worrisome warnings after recent patches)
  1999-03-04  8:42   ` Bernd Eggink
@ 1999-03-04 10:35     ` Bruce Stephens
  0 siblings, 0 replies; 4+ messages in thread
From: Bruce Stephens @ 1999-03-04 10:35 UTC (permalink / raw)
  To: zsh-workers

Bernd Eggink <eggink@uni-hamburg.de> writes:

> Andrej Borsenkow wrote:

> > What is the point of using NULL to initialize null pointer. The only
> > portable and official way is to use `0'(zero), that is garanteed to be
> > converted to whatever representation null pointer has on a given system.
> 
> No, this applies to C++ only, not to C. In C you should use the NULL
> macro or (void*)0.

There's an issue with arguments to functions which don't have
prototypes, but apart from that, the literal 0 as a pointer should be
fine in C.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: 0 vs. NULL (RE: Worrisome warnings after recent patches)
  1999-03-04  8:31 ` 0 vs. NULL (RE: Worrisome warnings after recent patches) Andrej Borsenkow
@ 1999-03-04  8:42   ` Bernd Eggink
  1999-03-04 10:35     ` Bruce Stephens
  0 siblings, 1 reply; 4+ messages in thread
From: Bernd Eggink @ 1999-03-04  8:42 UTC (permalink / raw)
  To: Andrej Borsenkow; +Cc: Sven Wischnowsky, zsh-workers

Andrej Borsenkow wrote:
> 
> > +         Cline to, tn = NULL;
> 
> What is the point of using NULL to initialize null pointer. The only
> portable and official way is to use `0'(zero), that is garanteed to be
> converted to whatever representation null pointer has on a given system.

No, this applies to C++ only, not to C. In C you should use the NULL
macro or (void*)0. 

Bernd

--
Bernd Eggink
Regionales Rechenzentrum der Uni Hamburg
eggink@rrz.uni-hamburg.de
http://www.rrz.uni-hamburg.de/eggink/BEggink.html


^ permalink raw reply	[flat|nested] 4+ messages in thread

* 0 vs. NULL (RE: Worrisome warnings after recent patches)
  1999-03-04  7:50 Worrisome warnings after recent patches Sven Wischnowsky
@ 1999-03-04  8:31 ` Andrej Borsenkow
  1999-03-04  8:42   ` Bernd Eggink
  0 siblings, 1 reply; 4+ messages in thread
From: Andrej Borsenkow @ 1999-03-04  8:31 UTC (permalink / raw)
  To: Sven Wischnowsky, zsh-workers

> +	    Cline to, tn = NULL;

What is the point of using NULL to initialize null pointer. The only
portable and official way is to use `0'(zero), that is garanteed to be
converted to whatever representation null pointer has on a given system.

I mention it, because I just recently have seen quite a number of bug
reports, that rsulted exactly from using something like NULL for this.

Just a reminder ...

/andrej


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1999-03-04 10:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-03-04 10:42 0 vs. NULL (RE: Worrisome warnings after recent patches) Sven Wischnowsky
  -- strict thread matches above, loose matches on Subject: below --
1999-03-04  7:50 Worrisome warnings after recent patches Sven Wischnowsky
1999-03-04  8:31 ` 0 vs. NULL (RE: Worrisome warnings after recent patches) Andrej Borsenkow
1999-03-04  8:42   ` Bernd Eggink
1999-03-04 10:35     ` Bruce Stephens

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).