Re: [ROOT] const int NGrafs = 5; // problem with const int declaration

From: Rene Brun (Rene.Brun@cern.ch)
Date: Thu Feb 12 2004 - 09:04:47 MET


Hi,

Do:

  const int NGrafs = 5, n=9;
  double y[NGrafs][n],ey[NGrafs][n],x[NGrafs][n],deltaMean[NGrafs][n];

Rene Brun

Venkat wrote:
> 
> Hi Rooters,
> I have a code snippet. When i run it as a macro, it runs fine. But when I
> put the same code in main() function it bombs.
> 
> Here's the declaration that's responsible for it.
> 
> {
>  ..... other code here
> 
>  Int_t n=9,ngr,i,j,dof;
>  Int_t NGrafs=5;
>  Double_t y[NGrafs][n];
> 
> }
> 
> Here's the error message..
> 
> Error: Non-static-const variable in array dimension
> FILE:Reso_Thresh_ALLPLOTS.C LINE:33
>  (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.)
> Error: Non-static-const variable in array dimension
> FILE:Reso_Thresh_ALLPLOTS.C LINE:33
>  (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 ***
> -------------------------------------------------
> I am also attaching the entire program with this. Can somebody help me
> figure out what's wrong with the declaration.
> Thanks in advance.
> Venkat.
> 
>   --------------------------------------------------------------------------------
>                              Name: Reso_Thresh_ALLPLOTS.C
>    Reso_Thresh_ALLPLOTS.C    Type: unspecified type (application/octet-stream)
>                          Encoding: quoted-printable



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:05 MET