Double a=b=c=d=0.; problem

Hi All,
this is a very stupid problem I incurred in today, which deals with variable declaration and initialization syntax.
In C++ you can declare a set of double variables and at the same time initialize them like this:

if you type the same thing in ROOT you get some warning messages

root [ ] double a=b=c=d=0; Warning: Automatic variable d is allocated (tmpfile):1: Warning: Automatic variable c is allocated (tmpfile):1: Warning: Automatic variable b is allocated (tmpfile):1:

and the result is that only ‘a’ has been declared as double, meanwhile ‘b’, ‘c’ and ‘d’ are integers. I don’t think that’s what one wants to happen, isn’t it?
cheers
salvo

Hi,

[quote=“yamiddu”]

this only works if b, c, and d are initialized. Otherwise this does not work in C++:

Cheers,
Charles

cplager@tableau> cat double.cc 
#include <iostream>

int main()
{
   double a = b = c = d = 0;
}
cplager@tableau> g++ double.cc 
double.cc: In function `int main()':
double.cc:5: error: `b' undeclared (first use this function)
double.cc:5: error: (Each undeclared identifier is reported only once for each function it appears in.)
double.cc:5: error: `c' undeclared (first use this function)
double.cc:5: error: `d' undeclared (first use this function)