[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    Re: kdenetwork/ktalkd/ktalkd
From:       Antonio Larrosa =?iso-8859-1?q?Jim=E9nez?= <larrosa () kde ! org>
Date:       2003-01-16 12:27:42
[Download RAW message or body]

El Jueves, 16 de Enero de 2003 11:15, Lubos Lunak escribió:
> On Thursday 16 of January 2003 01:49, Antonio Larrosa Jiménez wrote:
> > What would happen if you call a C function from a library you link to
> > from a C++ application with a NULL parameter ?
> > Something like:
> >
> > someCFunc( NULL );
> >
> > If NULL is defined different in C and in C++, then a check inside that
> > function for the parameter being NULL would fail, isn't it ?
>
>  I'd expect NULL to be implemented the same in C on such platforms. But
> either way, we wouldn't run that easily on those platforms anyway. How
> many cases do we have where we do memset( ... 0 ... ) to initialize
> pointers?

Hmm, I suppose you're right, calling fread(0/NULL, ...) would give problems 
anyway.

But still, there are many places where we use
int *pointer=0L;
what I'm worried about is using 0L in some cases and NULL in some others in 
platforms where NULL!=0L. I suppose that in those cases if (pointer) or 
passing NULL/0L parameters to methods/functions that check for the other 
value may not work. But as we have never had problems with that, I doubt 
it's really that serious.

Or did Dirk meant that if (!pointer) would be the same than if (pointer==0L 
|| pointer==NULL) in those platforms where NULL!=0L? In that case there 
wouldn't be a problem, but I doubt it works that way.

Greetings,

--
Antonio Larrosa Jimenez
KDE developer - larrosa@kde.org
http://developer.kde.org/~larrosa/
The clash of ideas is the sound of freedom.
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic