On Saturday 12 November 2005 13:36, Gabriel Dos Reis wrote: > I'm not convinced. I believe Per's suggestion is far superior, and > more general and does cover pretty well the issue at hand. Plus, > a pointer-type-without-null is another spelling for reference type. > I'm thinking of C here, where we don't have that luxury. The original RFE was in 20318 where they have some C functions that are guaranteed to return non-NULL (I'm quoting from memory here):
int *this_never_returns_NULL (void) __attribute__ ((never_returns_null)); We would not want to pin the never-null attribute to 'int *': foo() { int *p = this_never_returns_NULL (); < ... use p without modifying it ... > <-- p is never NULL here. p = other_fn (); < ... use p without modifying it ... > <-- p may be NULL here. } In languages where you could make the type itself have that guarantee, then great, let's use the type attributes. In type-challenged languages, we use whatever we can get our hands on.