Potentially bug?

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Post Reply
Quark
Transport Coordinator
Transport Coordinator
Posts: 325
Joined: 20 Sep 2006 11:36
Location: Russia, Moscow

Potentially bug?

Post by Quark »

Code: Select all

.\network.c(86): warning #175: subscript out of range
  	for (cs = _clients; cs != &_clients[MAX_CLIENT_INFO]; cs++) {
  	                                   ^

Code: Select all

NetworkClientState _clients[MAX_CLIENTS];

Code: Select all

#define MAX_CLIENT_INFO (MAX_CLIENTS + 1)
Image
User avatar
Darkvater
Tycoon
Tycoon
Posts: 3053
Joined: 24 Feb 2003 18:45
Location: Hong Kong

Post by Darkvater »

Yes, looks like it. That's why one should use macros and not type by hand :( . The code below will always be correct. I'll pass this on to Rubidium.

Code: Select all

for (cs = _clients; cs != endof(_clients); cs++) {
TrueLight: "Did you bother to read any of the replies, or you just pressed 'Reply' and started typing?"
<@[R-Dk]FoRbiDDeN> "HELP, this litte arrow thing keeps following my mouse, and I can't make it go away."
Haukinger
Engineer
Engineer
Posts: 110
Joined: 15 Mar 2006 16:38

Post by Haukinger »

I'd love to see something like this:

Code: Select all

for ( Client_List_Type::iterator cs=_clients.begin(); cs!=_clients.end(); ++cs )
It's even more always correct ;)
User avatar
Darkvater
Tycoon
Tycoon
Posts: 3053
Joined: 24 Feb 2003 18:45
Location: Hong Kong

Post by Darkvater »

Fixed r7984, thanks Quark for noticing.
TrueLight: "Did you bother to read any of the replies, or you just pressed 'Reply' and started typing?"
<@[R-Dk]FoRbiDDeN> "HELP, this litte arrow thing keeps following my mouse, and I can't make it go away."
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 7 guests