看板 DFBSD_submit 關於我們 聯絡資訊
On Fri, Feb 25, 2005 at 02:21:59PM -0800, Kevin M. Kilbride wrote: > >I agree. Adding a const attribute to system interfaces will _never_ > >break calling code, since it simply advertises a guarantee that the > >code will not change what is supplied. The code either does or it > >doesn't. If it truly doesn't, then why not advertise it as such? It > >can hardly be argued as "breaking" the POSIX interface. There is no > >real hope of making all of userland truly WARNS=6 compliant without it. What about code which correctly uses -Wbad-function-cast or -Wcast-qual in combination with -Werror? That code breaks. const char ** and char ** are not type compatibel in ISO C. That's IMO a shortcoming in ISO C, but we can't fix it. Changing the interface adds problems. It is possible to use e.g. __DECONST for exactly this occurences, but it has to be done explicitly and it is easy to find all users of such macros to verify the correctness of those. Joerg