Weirdest RVCT 1.2 Behavior | developer.brewmp.com Weirdest RVCT 1.2 Behavior | developer.brewmp.com

Developer

Weirdest RVCT 1.2 Behavior

Forums:

I've got a Regular Vector template along with a addElement(const T&).

In the same function, I call addElement, the first element is added. Then addElement again, guess what, addElement is not called at all. How do I know? Well, using a regular DBGPRINTF outside and inside addElement....yet further along in another function, addElement is called.

STRANGE!!! It's like the code to call addElement did not exist.

I figure if RVCT compiled the code, it should run :rolleyes: MSVC 7.0 has no problems with compilation and the running.

Anyone who may know template gotchas?

Thank-you,
W

Can't remember the specifics, but I did run into a template construct once on the ADS 1.2 (i.e. exactly the same compiler as RVCT 1.2) that compiled fine - but did completely the wrong thing. I *think* I had a static member template function, which I used in various guises - let's say function and function - but the code always called function. Again, from memory (it was about 5 years ago) but I think the solution was to ditch templates and use a set of overloaded functions instead.
What's the exact construct? I can try it on RVCT 1.2 and RVDS 3.0 to see if it's improved there.

Can't remember the specifics, but I did run into a template construct once on the ADS 1.2 (i.e. exactly the same compiler as RVCT 1.2) that compiled fine - but did completely the wrong thing. I *think* I had a static member template function, which I used in various guises - let's say function and function - but the code always called function. Again, from memory (it was about 5 years ago) but I think the solution was to ditch templates and use a set of overloaded functions instead.
What's the exact construct? I can try it on RVCT 1.2 and RVDS 3.0 to see if it's improved there.

it clearly isn't quite as simple a case as I just described, because I just tested it, and it worked....
would love to know what your code construct is.

it clearly isn't quite as simple a case as I just described, because I just tested it, and it worked....
would love to know what your code construct is.

Are you testing on the phone? If you are you might want to try turning on synchronous DBGPRINTS... I ran into huge problems with mine as well and things were and were not printing in what seemed completely random order. #######7 in the app manager turns on synchronous output.
Beware that your application will run a LOT slower as every single call to DBGPRINTF will now be allowed to complete before continuing (this includes phone dbg messages)

Are you testing on the phone? If you are you might want to try turning on synchronous DBGPRINTS... I ran into huge problems with mine as well and things were and were not printing in what seemed completely random order. #######7 in the app manager turns on synchronous output.
Beware that your application will run a LOT slower as every single call to DBGPRINTF will now be allowed to complete before continuing (this includes phone dbg messages)

KAJed wrote:Are you testing on the phone? If you are you might want to try turning on synchronous DBGPRINTS... I ran into huge problems with mine as well and things were and were not printing in what seemed completely random order. #######7 in the app manager turns on synchronous output.
Beware that your application will run a LOT slower as every single call to DBGPRINTF will now be allowed to complete before continuing (this includes phone dbg messages)
Slower even that - it just adds a 100ms (I think) delay to each DBGPRINTF, as it doesn't know when they complete.

KAJed wrote:Are you testing on the phone? If you are you might want to try turning on synchronous DBGPRINTS... I ran into huge problems with mine as well and things were and were not printing in what seemed completely random order. #######7 in the app manager turns on synchronous output.
Beware that your application will run a LOT slower as every single call to DBGPRINTF will now be allowed to complete before continuing (this includes phone dbg messages)
Slower even that - it just adds a 100ms (I think) delay to each DBGPRINTF, as it doesn't know when they complete.

IMO Its worth the painful slowness if it'll help diagnose your problem :) it's the only thing that saved me in my last battle with BREW

IMO Its worth the painful slowness if it'll help diagnose your problem :) it's the only thing that saved me in my last battle with BREW

My Pointer template has a user-conversion as below.
Pointer
template operator Pointer()
{
return Pointer(pointee);
}
The Vector template has the below function.
Vector
void addElement(const T& obj);
class Object;
class Car : Object
class Rock : Object;
Pointer car1;
Pointer car2;
Pointer rock;
Vector< Pointer > objects;
objects.addElement(car1); // REALLY BAD NEWS on RVCT 1.2
objects.addElement(car2);
objects.addElement(rock);
One or more of the 3 addElement() will "fail" on actual phone. I saw no crash, but I did not bother to track down why it did not crash.
BenBlaukopf wrote:it clearly isn't quite as simple a case as I just described, because I just tested it, and it worked....
would love to know what your code construct is.

My Pointer template has a user-conversion as below.
Pointer
template operator Pointer()
{
return Pointer(pointee);
}
The Vector template has the below function.
Vector
void addElement(const T& obj);
class Object;
class Car : Object
class Rock : Object;
Pointer car1;
Pointer car2;
Pointer rock;
Vector< Pointer > objects;
objects.addElement(car1); // REALLY BAD NEWS on RVCT 1.2
objects.addElement(car2);
objects.addElement(rock);
One or more of the 3 addElement() will "fail" on actual phone. I saw no crash, but I did not bother to track down why it did not crash.
BenBlaukopf wrote:it clearly isn't quite as simple a case as I just described, because I just tested it, and it worked....
would love to know what your code construct is.