Guennadi Liakhovetski wrote:How should gcc know whether you actually wanted that char foo[len] to contain a \0 as last element? Given the respective command line switches, gcc does warn in some cases where it is guesswork whether what you typed is what you intended. For example if (i = j()) is reason for gcc to warn even if that might exactly be what you wanted. However this construct can easily be annotated as if ((i = j())) to show to gcc and to carbon-based bipedals that you indeed wanted this. Now there is no nice way to make an annotation that says "look, I'm going to initialize an array of char with a string literal now, and the resulting array will contain a non-zero member as last element, and I mean it". And since there is no such annotation possible, gcc does not warn and demand that you annotate the perfectly valid and 100% spec-compliant construct char a[4] = "1234";. -- Stefan Richter -=====-=-=== =--- ---== http://arcgraph.de/sr/ -
| Greg KH | [GIT PATCH] driver core patches against 2.6.24 |
| Tarkan Erimer | Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3 |
| Srivatsa Vaddagiri | containers (was Re: -mm merge plans for 2.6.23) |
| Benjamin Herrenschmidt | Re: [linux-pm] [PATCH] Remove process freezer from suspend to RAM pathway |
git: | |
| David Miller | Re: [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| Gerrit Renker | [PATCH 27/37] dccp: Integration of dynamic feature activation - part 2 (server side) |
| Patrick McHardy | Re: [GIT]: Networking |
| Gerrit Renker | [PATCH 6/7] [CCID-2/3]: Fix sparse warnings |
