On Wed May 25, 2005 at 13:14:34 +1000, Erik de Castro Lopo wrote:
>Benno wrote:
>
>> Doesn't fix the problem. The implementation of the functions don't
>> include. the header with the shadowing. A more full example follows:
>>
>> ### foo.h
>>
>> int foo(int bar);
>>
>>
>> ### foo.c
>>
>> #include <foo.h>
>>
>> int foo(int bar) { return bar * 2; }
>
>You have to admit that this is a somewhat artifical example, but
>lets ignore that for the moment.
Weell yeah of course it is, but is the smallest bit of code I could
write to make the problem clear ;).
>if foo and bar are external libraries developed by different
>teams then all public functions should probably be named
>foo_whatever and bar_whatever. That will avoid the clash
>in variable names as well. In the worst case you can probably
>find a way to wrap the names.
True, I think that gcc treating parameter names in function
declarations as `public' is total arse though.
>If OTOH foo and bar are are part of the same project then
>everything is under control and you have the power to fix
>things. If you have a test suite the job won't take more
>than an hour even on large prjects. Once fixed you never
>have to worry about the problem again.
Until the next time you decide to create a private function that
happens to have the same name as an argument in some header file.
Or I fall back to the last line of defense: index() isn't the C
standard and I want to use it as a variable name damnit!
Cheers,
Benno
P.S: Thats all from me on this thread... I'm happy to leave it at the
we disagree stage ;)
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html