Re: [ROOT]null pointer in function call

From: Damir Buskulic (buskulic@lapp.in2p3.fr)
Date: Sat May 13 2000 - 16:00:41 MEST


Hi,

Yes, I tried NULL and the behaviour is the same. This is on LinuxPPC with
gcc 2.95.2 and ROOT version 2.24/04 wich uses CINT 5.14.37.
I didn't try with other machines but I will on monday.

Cheers

Damir

=====================================================================
| Damir Buskulic                  | Universite de Savoie/LAPP       |
|                                 | Chemin de Bellevue, B.P. 110    |
| Tel : +33 (0)450091600          | F-74941 Annecy-le-Vieux Cedex   |
| e-mail: buskulic@lapp.in2p3.fr  | FRANCE                          |
=====================================================================
mailto:buskulic@lapp.in2p3.fr

On Fri, 12 May 2000, Roberto Divia` wrote:

> Damir Buskulic wrote:
> > I have a function (compiled) that waits for a pointer of a certain type,
> > say FrVect*. It is allowed to pass it a null pointer. Let's say the
> > prototype of the function is
> > My_Function(FrVect* vector)
> > When I do
> > 
> > My_Function(0) it says that there is no such function but
> > 
> > My_Function((FrVect*)0) works.
> > 
> > This was working without explicit cast in 2.23/12. Is it a new feature ?
> > I don't remember what the C standard says. Or is it just still a problem
> > in cint with implicit type conversion ?
> 
> Damir,
>   don't know the details about ROOT, but the C standard says you should
> use NULL (defined in stddef.h, stdlib.h, string.h, time.h and several
> other places). NULL should be guaranteed to be a pointer and in most of
> the cases it is defined as 0.
> 
>   About the C++ standard, the explicit casting may be necessary to choose
> the right function prototype. Try with NULL.
> 
> Ciao,
> -- 
> +-----------------------+----------------------------------------------+
> |   Roberto Divia`      | Love at  first sight  is one of the greatest |
> |   =============       | labor-saving devices the world has ever seen |
> +-----------------------+----------------------------------------------+
> |  CERN :  European Laboratory for Particle Physics,  1211  Geneva  23 |
> |  Switzerland (CH)                      E-mail: Roberto.Divia@cern.ch |
> +----------------------------------------------------------------------+
> 



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:25 MET