[ROOT] Array initialization

From: Masaharu Goto (MXJ02154@nifty.ne.jp)
Date: Mon Jun 18 2001 - 13:47:40 MEST


Hello Abi,

Thank you for your report. Indeed, Cint is prohibiting this kind of
initialization. In fact, behavior to this kind of initialization differs
from compiler to compiler.  Some compilers do not allow this, if I remember
correctly. It depends on how you interpret following clause in ANSI/ISO C++. 


8.5.1  Aggregates                                      [dcl.init.aggr]

1 An aggregate is an array or a class (clause  _class_)  with  no  user-
  declared  constructors  (_class.ctor_),  no  private or protected non-
  static data members (clause _class.access_), no base  classes  (clause
  _class.derived_), and no virtual functions (_class.virtual_).


In theory, it is possible. If this is important, please let me know.

Thank you
Masaharu Goto


>CINT doesn't allow you to initialize array elements if they are of a
>user-defined
>type. For example:
>
>root [2] TString yes("yes");
>root [3] TString t[2] = {yes, yes}}
>!!!Bad command input. Ignored!!!
>root [4] TString t[2] = {yes, yes}
>Error: Illegal initialization of t[2]. Constructor exists 
>FILE:/tmp/fileBu9dJL_cint LINE:1
>*** Interpreter error recovered ***
>
>This works if the code is manually compiled, or if I use a double instead of
>TString.



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:49 MET