This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: Patch to use concat instead of xmalloc/sprintf for JAVA dir
- To: Richard dot Earnshaw at arm dot com, mark at codesourcery dot com
- Subject: Re: Patch to use concat instead of xmalloc/sprintf for JAVA dir
- From: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- Date: Mon, 23 Apr 2001 11:53:52 -0400 (EDT)
- Cc: gcc-patches at gcc dot gnu dot org, java-patches at gcc dot gnu dot org, per at bothner dot com
> From: Richard Earnshaw <rearnsha@arm.com>
>
> > >>>>> "Kaveh" == Kaveh R Ghazi <ghazi@caip.rutgers.edu> writes:
> >
> > Kaveh> Regarding NULL vs NULL_PTR, there is some inconsistency as
> > Kaveh> both styles are currently used in calls to concat. However
> > Kaveh> NULL_PTR is deprecated according to comments in ansidecl.h
> > Kaveh> where it is defined, so I used NULL.
> >
> > Hmm. I thought we were supposed to use NULL_PTR (like NULL_RTX and
> > NULL_TREE). But, I see that on the trunk there is indeed the comment
> > you mentioned. So, I think using NULL is correct, and that we should
> > stop using NULL_PTR on the trunk.
>
> IIUC, NULL_PTR is useful as a parameter to functions which might not have
> a prototype in force. This ensures that the size of the pointer is
> correct on targets where pointer size is not the same as sizeof(int).
> NULL_PTR has a type, whereas NULL does not.
>
> Of course, most targets that have such behaviour should probably be
> enforcing the use of prototypes nowadays...
> R.
Right, GCC itself is fully prototyped these days. So in reality
NULL_RTX & NULL_TREE could probably be removed too, though its not
pressing. We only have to consider what happens with variable
argument functions which don't offer the benefit of prototype
conversions, or platforms with K&R system headers.
My experience has been that on all system where sizeof(int) is less
than sizeof(ptr) that NULL is defined appropriately to handle this,
e.g. "0L". This is the case on at least alpha-osf, solaris2.7 and
irix6, to name a few 64 bit capable platforms. Given that many uses
of concat currently use NULL, this appears to work in practice. :-)
--Kaveh
--
Kaveh R. Ghazi Engagement Manager / Project Services
ghazi@caip.rutgers.edu Qwest Internet Solutions