[Clam-devel] Const correctness in Processing Data

Xavier Amatriain xavier at amatriain.net
Mon Apr 28 14:07:25 PDT 2008


Uhm... maybe we already talked about this at some point but it just 
struck me:

If you look at, for example, AudioFileOut.cxx:147 you see the following 
line:

DataArray &array = in.GetBuffer();

The problem is that the in variable has been passed as "const" but is 
being assigned a non const reference. The corrected line should be

const DataArray &array = in.GetBuffer();

If you replace the Audio class by a non Dynamic Type class, the compiler 
complains and forces you to do the 2nd. Why isn't this the
case with DTs? Isn't this a bit "spooky"? :-)

X




More information about the clam-devel mailing list