Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Aug 2002 18:33:00 -0700 (PDT)
From:      Archie Cobbs <archie@dellroad.org>
To:        obrien@freebsd.org
Cc:        freebsd-arch@freebsd.org
Subject:   Re: NULL
Message-ID:  <200208210133.g7L1X0N03964@arch20m.dellroad.org>
In-Reply-To: <20020821012901.GA34047@dragon.nuxi.com> "from David O'Brien at Aug 20, 2002 06:29:01 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
David O'Brien writes:
> > > In C++ this is not legal:
> > > 
> > >     void blah(void) {
> > >         int *foo;
> > >         void *bar;
> > >         bar = foo;
> > >         foo = bar;
> > >     }
> ...
> > When you say "not legal" do you mean it causes an error or a warning?
> 
> Easy enought to try yourself (/void blah/int main/ and add return 0;) :-)
> 
>     $ ls -l a.out
>     ls: a.out: No such file or directory
>     $ CC voidp.cxx 
>     voidp.cxx: In function `int main()':
>     voidp.cxx:6: invalid conversion from `void*' to `int*'
>     $ ls -l a.out
>     ls: a.out: No such file or directory

Thanks...

So how does C++ on Linux get away with (void *)0?

-Archie

__________________________________________________________________________
Archie Cobbs     *     Packet Design     *     http://www.packetdesign.com

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200208210133.g7L1X0N03964>