This site is no longer active and is available for archival purposes only. Registration and login is disabled.

eVC3 - No Device Installed?


Postby Kzinti » Jan 21, 2004 @ 7:19pm

Kzinti
pm Member
 
Posts: 3238
Joined: Jan 13, 2002 @ 5:23am


Postby Kzinti » Jan 21, 2004 @ 7:22pm

Kzinti
pm Member
 
Posts: 3238
Joined: Jan 13, 2002 @ 5:23am


Postby mlepage » Jan 21, 2004 @ 7:46pm

Sorry Thierry, look at the code again. nCol never goes out of range.

The case is the path through the switch. It varies from 0 to 6, but only cases 5 and 6 do anything in this version.

The column varies from 0 to 7. It never goes out of range, because the nextCol function wraps from 7 back down to 0.

I don't see any place where nCol can go beyond 7.

Don't be so quick to blame my code when the optimizer is at fault. :-)

In actual fact, I've seen optimizer bugs on several platforms over 3 years of porting code to 5 flavours of Unix. As I mentioned, the DEC Alpha optimizer, on 64 bit machines, was extremely buggy. So I have seen a variety of optimizer bugs before.

That said, I am not quick to blame the optimizer at all. It never occurred to me that this was an optimizer bug at first. My first hunch was it was an iterator invalidation problem in another area of my code. But when I saw the view display things in places they shouldn't be, I knew the problem was here (where they are created). I went over the code visually and couldn't see the problem, so I began adding log output to track it down. (I couldn't debug because I can't debug remotely and it doesn't appear in debug builds.) Once the log output removed the problem, I knew I had an optimizer error situation. I've seen it many times before.
www.scalenesoftware.com
Great games for your Palm and Pocket PC!
User avatar
mlepage
pm Insider
 
Posts: 1050
Joined: Aug 3, 2003 @ 4:47am
Location: Canada


Postby Pam » Jan 21, 2004 @ 7:49pm

Doesn't nCol have to equal 8 before it can exit the for loop?

Pam
All the easy problems have been solved.
User avatar
Pam
pm Insider
 
Posts: 449
Joined: Jan 24, 2002 @ 10:30pm
Location: Ohio


Postby Kzinti » Jan 21, 2004 @ 7:53pm

Kzinti
pm Member
 
Posts: 3238
Joined: Jan 13, 2002 @ 5:23am


Postby Kzinti » Jan 21, 2004 @ 8:00pm

Kzinti
pm Member
 
Posts: 3238
Joined: Jan 13, 2002 @ 5:23am


Postby Dan East » Jan 21, 2004 @ 8:04pm

User avatar
Dan East
Site Admin
 
Posts: 5264
Joined: Jan 25, 2001 @ 5:19pm
Location: Virginia, USA


Postby Dan East » Jan 21, 2004 @ 8:07pm

Last edited by Dan East on Jan 21, 2004 @ 10:27pm, edited 1 time in total.
User avatar
Dan East
Site Admin
 
Posts: 5264
Joined: Jan 25, 2001 @ 5:19pm
Location: Virginia, USA


Postby Kzinti » Jan 21, 2004 @ 8:12pm

Kzinti
pm Member
 
Posts: 3238
Joined: Jan 13, 2002 @ 5:23am


Postby mlepage » Jan 21, 2004 @ 9:10pm

www.scalenesoftware.com
Great games for your Palm and Pocket PC!
User avatar
mlepage
pm Insider
 
Posts: 1050
Joined: Aug 3, 2003 @ 4:47am
Location: Canada


Postby mlepage » Jan 21, 2004 @ 9:12pm

www.scalenesoftware.com
Great games for your Palm and Pocket PC!
User avatar
mlepage
pm Insider
 
Posts: 1050
Joined: Aug 3, 2003 @ 4:47am
Location: Canada


Postby Kzinti » Jan 21, 2004 @ 10:02pm

Last edited by Kzinti on Jan 22, 2004 @ 1:24am, edited 1 time in total.
Kzinti
pm Member
 
Posts: 3238
Joined: Jan 13, 2002 @ 5:23am


Postby Dan East » Jan 21, 2004 @ 10:12pm

User avatar
Dan East
Site Admin
 
Posts: 5264
Joined: Jan 25, 2001 @ 5:19pm
Location: Virginia, USA


Postby Kzinti » Jan 22, 2004 @ 1:22am

Kzinti
pm Member
 
Posts: 3238
Joined: Jan 13, 2002 @ 5:23am


Postby Dan East » Jan 22, 2004 @ 2:03am

Thierry's right:

RAND_MAX
The constant RAND_MAX is the maximum value that can be returned by the rand function. RAND_MAX is defined as the value 0x7fff.


Having to use floating point math to generate a random int is not good performance-wise. You only need to go to that trouble if you want to return random numbers greater than RAND_MAX.

To return a number n that is 0 <= n < max <= (RAND_MAX+1) use this:

#define RAND_INT(max) (rand() % (max))

If max is base 2 then this is faster:

#define RAND_INT(max) (rand() & ((max)-1))

Also, your existing RAND_INT macro can fail in other cases. For example RAND_INT(4+4) will not work properly. You always need to put all macro parameters in parenthesis, as I did above with max.

Dan East
User avatar
Dan East
Site Admin
 
Posts: 5264
Joined: Jan 25, 2001 @ 5:19pm
Location: Virginia, USA


PreviousNext

Return to Windows Mobile


Sort


Forum Description

A discussion forum for mobile device developers on the Windows Mobile platform. Any platform specific topics are welcome.

Moderators:

Dan East, sponge, Digby, David Horn, Kevin Gelso, RICoder

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

cron