Re: passing pointers to pointers in Cint

From: Valeri Fine (Faine) (fine@bnl.gov)
Date: Thu Sep 23 1999 - 20:56:42 MEST


> here is a little test macro "test.C" :
> 
> void test(Int_t **bidim) {
>   cout << bidim << endl;
>   cout << bidim[0] << endl;
>   cout << bidim[1] << endl;
>   cout << bidim[0][0] << endl;
> }
> 
...

> root [20]  test(bidi)
> 0x52bd68
> 0
> 0
> 
>  *** Break *** segmentation violation
> Root > bidi[0]
> (Int_t*)0x52bd68
> root [22] 
> 
> Is this a known limitation of Cint or a bug ?
> I am using  root 2.22.10 on SunOS

It is a bug but yours.
The "regular" compiler explains what you did wrong.

[sol] ~/tmp > CC -c t.c
"t.c", line 11: Error: Formal argument bidim of type int** in call to test(int**) is being passed int(*)[10].
1 Error(s) detected.



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:39 MET