UFO:Alien Invasion

Development => Coding => Topic started by: oeystein on July 16, 2007, 10:15:55 am

Title: net.c issue
Post by: oeystein on July 16, 2007, 10:15:55 am
In net.c the following is declared:
Code: [Select]

const char * stream_peer_name (struct net_stream *s, char *dst, int len)
{
if (!s)
return "(null)";
else if (stream_is_loopback(s))
return "loopback connection";
else {
char buf[s->addrlen];
void *src;


As you can see, there is an attempt to dynamically initialize the size of array buf based on the variable s->addrlen. Is this standard C? It wont compile in VS2005.
Title: net.c issue
Post by: Mattn on July 16, 2007, 11:43:42 am
no, this should not be allowed in c89 or c99 - i will look that up and fix it
Title: net.c issue
Post by: Zenerka on July 16, 2007, 12:10:02 pm
IMO C99 allows that.