Henk Jonas wrote:

Eric Potter wrote:

I'm using CodeWarrior 9.2, and I'm getting a strange compiler error. The following line of code compiles fine in the debug target, but gives the following message in the release target.

const sclRepeat& scrollRepeat = pEvent->data.sclRepeat;


Error   : 'const' or '&' variable needs initializer
DiaryDayForm.cpp line 906 const sclRepeat& scrollRepeat = pEvent->data.sclRepeat;


Just for curiousity: what do you want the compiler to do? Maybe it's valid C, who knows, but I've never seen a contruction like this, or even used it. Why do you need it?

It's C++. The '&' makes 'scrollRepeat' a reference (which is like a pointer where you can't change the address). The construct means that using 'scrollRepeat' is the same as using 'pEvent->data.sclRepeat' except (because of the 'const'), you can't change it through 'scrollRepeat'.

FWIW, best I can tell, this declaration is correct.

--
Wade Guthrie
[EMAIL PROTECTED]


--
For information on using the PalmSource Developer Forums, or to unsubscribe, 
please see http://www.palmos.com/dev/support/forums/

Reply via email to