Dne p=E1 18. kv=ECten 2001 19:43 Dirk Mueller napsal(a):
> On Fre, 18 Mai 2001, Rik Hemsley wrote:
> >
> > - if( !startup_widget ) {
> > + if (0 =3D=3D startup_widget) {
> >
- if(0 =3D=3D startup_widget ) {
+ if( static_cast< QWidget* >( 0 ) =3D=3D startup_widget ) {
> >
> > Just kidding, but I don't like to see boolean operators
> > used to test pointer values. Call me pedantic ;)
>
> Discussing this is more of philosophical nature, but IMHO using a boole=
an
> operature is just right. you can't assume anything about a pointer valu=
e,
> so I think using a boolean operator in the sense of "is this valid?" is
> better.
Integral 0 is always converted to null pointer, regardless of how the nu=
ll=20
pointer is represented. Even if null pointer is actually binary represent=
ed=20
as integral 0x12348765 , as long as NULL is #define NULL 0 ( or const int=
=20
NULL =3D 0; ... who cares ), everything is fine.
The important thing is that it works, and I think we should continue in =
this=20
discussion only when something really breaks ( and I think I can with ver=
y=20
good accurancy say the exact date when this will happen : 'never' ).
>
> anyway..
>
>
> Dirk
Lenin oops I mean NULL was, is and will be ... :)
Lubos Lunak
--
l.lunak@email.cz ; l.lunak@kde.org
http://dforce.sh.cvut.cz/~seli