pointer dereferencing

BORKOWSKI Jerzy (Jerzy.Borkowski@obs.unige.ch)
Mon, 16 Jun 1997 14:34:38 +0200 (METDST)


Greetings,

I have a couple of questions regarding pointer dereferencing in ROOT.
These may be very easy to answer, but I'm new to ROOT. Look at the
following (Sun Ultra 140 / single CPU / Solaris 2.5) ...

> CINT/ROOT C/C++ Interpreter version 5.13.11, May 25 1997
> Type ? for help. Commands must be C++ statements.
> Enclose multiple statements between { }.
> root [0] char *p = "123456"
> root [1] char **pp = &p
> root [2] p
> (char* 0x3a3140)"123456"
> root [3] p[0]
> (char 49)'1'
> root [4] *p
> (int)49
> root [5] pp
> (char**)0x3a3150
> root [6] *pp
> (char* 0x3a3140)"123456"

so far, so good, but ...

> root [7] **pp
> Error: * Illegal operator for pointer 3 FILE:/var/tmp/haaa002Ds LINE:1
> *** Interpreter error recovered ***
> root [8] (*p)
> (int)49
> root [9] (*pp)
> (char* 0x3a3140)"123456"
> root [10] (*pp)[0]
> Error: Pointer to function 0x3a3150 can not access from interpreter(2)
> FILE:/var/tmp/kaaa002Ds LINE:1
> Error: G__getvariable: expression [0] FILE:/var/tmp/kaaa002Ds LINE:1
> *** Interpreter error recovered ***
> root [11] *(char *)(*pp)
> (char 49)'1'

1. I understand that CINT promotes result of *p from char to int (is this
intentional/correct ?), and does not promote result of p[0] (the same
questions)

2. Why **pp does not work and *(char *)(*pp) works (this may have something
to do with previous question) ?

3. Is it possible to change directory in which temporary files are created,
namely from /var/tmp to /tmp (environment variable) ?

best regards,

Jurek

----------------------
Jerzy Borkowski phone: +41 22 950 91 43 (direct)
INTEGRAL Science Data Centre +41 22 950 91 00 (switchb.)
Chemin d'Ecogia 16 fax: +41 22 950 91 33
CH-1290 VERSOIX e-mail: Jerzy.Borkowskiobs.unige.ch
Switzerland WWW: http://obswww.unige.ch/isdc/