D
Duncan Smith
Having a cpp background I'm curious why I can't do the following:
const int openElementPosition = strXmlLine.IndexOf("<RacingNumber");
without getting the following error:
Error 1 The expression being assigned to 'closeElementPosition' must
be constant
If I drop the const then everything is fine, but I don't ever want to
change the value of openElementPosition so it would be better/safer as
a const. Assuming IndexOf returns a scalar integer value, why
shouldn't I be free to store it in a const variable?
Confused,
Duncan.
const int openElementPosition = strXmlLine.IndexOf("<RacingNumber");
without getting the following error:
Error 1 The expression being assigned to 'closeElementPosition' must
be constant
If I drop the const then everything is fine, but I don't ever want to
change the value of openElementPosition so it would be better/safer as
a const. Assuming IndexOf returns a scalar integer value, why
shouldn't I be free to store it in a const variable?
Confused,
Duncan.