From -6844690613569296941
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,da46f9d6feb862e5
X-Google-Attributes: gidf78e5,public
From: David R Tribble <dtribble@technologist.com>
Subject: Re: Is this well-formed?
Date: 1999/04/27
Message-ID: <3724F9D3.B7A9F65B@technologist.com>#1/1
X-Deja-AN: 471290844
X-NNTP-Posting-Host: dalnt9.beasys.com
Content-Transfer-Encoding: 7bit
Approved: stephen.clamage@sun.com (comp.std.c++)
References: <7f1nnv$6c$1@weber.techno-link.com> <371655EE.948EA1E6@technologist.com> <QQglev00422.199904161429@relay7.UU.NET> <371F37BE.E9ED31D@physik.tu-muenchen.de>
X-Accept-Language: en
X-UID: 0000000001
X-Status: $$$T
Content-Type: text/plain; charset=us-ascii
X-Complaints-To: newsmaster@beasys.com
X-Trace: svlinweb.beasys.com 925170316 6936 206.189.43.219 (26 Apr 1999 23:45:16 GMT)
Organization: File by pile
Mime-Version: 1.0
NNTP-Posting-Date: 26 Apr 1999 23:45:16 GMT
Newsgroups: comp.std.c++
Originator: clamage@taumet


David R Tribble <dtribble@technologist.com> wrote
>>> Gee, wouldn't it be nice if C++ had a 'null' keyword?

Christopher Eltschka wrote:
>...
> However, it doesn't really need a keyword, the following
> should work on a conforming compiler:
>...
> 
>  class null
>  {
>  public:
>    template<class T> operator T*() { return 0; }
>    static null get() { return null(); }
>  private:
>    null();
>    null(null const&);
>  };
>  
>  #define null (null::get())

Nice little addition, that rvalue thing.

I know there's no chance of getting this widely accepted in any
"standard" sense, but wouldn't this be fairly easy to add to g++?
This would help establish "existing practice" for the next
go-around on std C++.

I saw somewhere that one version of the compiler used '__NULL__'
as a real built-in null constant (which the header files
conveniently #defined NULL to be).

I must also re-iterate my opinion on adding 'null' to C++, that
this should not in any way replace the use of 0, at least for
several years.  Eventually, if enough people haved switched
from 0 to 'null', we can argue about getting rid of "0 as null";
but this won't happen for a while yet, if ever.

-- David R. Tribble, dtribble@technologist.com --


[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]




