This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Null pointer check elimination


Per Bothner wrote:
A "function-never-returns-null" attribute doesn't seem like
the right mechanism.  Instead, there should be a "never-null"
attribute on pointer types.  A "function-never-returns-null" is
just a function whose return-type has the "never-null" attribute.

Gabriel Does Reis wrote:
We already have such mechanism: a reference type -- which morally is
implemented as a pointer type.

Andrew Pinski wrote:
That was mentioned a way ago as being wrong. A reference type can be NULL.

There are other differences, at least in C++: If you assign to a pointer, you change the pointer, while if you assign to a reference you modify the referenced object. I.e. if a variable has reference type, then the reference itself is constant. -- --Per Bothner per@bothner.com http://per.bothner.com/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]