|
From: | address@hidden |
Subject: | Re: [lwip-devel] Compile error in 1.4.0 |
Date: | Fri, 24 Feb 2012 15:34:02 +0100 |
User-agent: | Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2 |
address@hidden wrote:
I don't know if it is a known problem but I stumbled upon this: In dhcp.c line 1683 my compiler fails with an error here: for (i = 0; i< DHCP_CHADDR_LEN; i++) { /* copy netif hardware address, pad with zeroes */ dhcp->msg_out->chaddr[i] = (i< netif->hwaddr_len) ? netif->hwaddr[i] : 0/* pad byte*/; }
I don't think that's a problem, the compiler just doesn't see that there's a condition to the array-access. I'd rather think that's a problem in the compiler, not in lwIP. We could change the code of course, but who tells us that the next compiler then doesn't have a problem?
Out of interest, which compiler are you using that produces this warning? I'd be interested in what makes the compiler warning go away, using if/else instead of ?:, or only using 2 loops?
Wouldn't it be better to replace this construct by a more secure one the compiler is happy with?
I'm sorry but I don't see what's "insecure" about the construct? You could argue that the ?: C statement is bad coding style (as it's easily overseen by non-C guys), but insecure??
Simon
[Prev in Thread] | Current Thread | [Next in Thread] |