[ROOT] dynamic allocation and string

From: Tommaso Chiarusi (Tommaso.Chiarusi@bo.infn.it)
Date: Thu Mar 14 2002 - 19:33:54 MET


Hi all,
1) 
since with the following simple macro

void main()
{
  int n=3;
  int nn[n];
}

I get the following error:

------------------
Error: Non-static-const variable in array dimension FILE:provafile.C 
LINE:47
 (cint allows this only in interactive command and special form macro 
which
  is special extension. It is not allowed in source code. Please ignore
  subsequent errors.)
*** Interpreter error recovered*** 
------------------

Which is the special extension I must give to my macro to abilitate 
dynamic allocation memory?

2) Since I need to manipulate arrays of strings, instead to use the 
C-style string (char p or char *p) I must use Class <string>.
The fact is that I manipulate filenames, which I must pass to TTree 
constructor, which need old C-style strings.
Then I use the c_str() method to convert a <string> to a C-string.
Unfortunatly at the end of my macro I get the following error:

----------
*** Break *** segmentation violation
Root > Function faitree_obj_dev() busy flag cleared
Function c_str() busy flag cleared
Function length() busy flag cleared
----------

My macro does what it must do, bu after that I have to quit ROOT and 
restart.

What's wrong?

Cheers, Tommaso



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:45 MET