bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bison 1.875 variable vs. function name clash: accept


From: Jonathan Ward
Subject: Re: bison 1.875 variable vs. function name clash: accept
Date: Mon, 19 May 2003 10:23:55 -0400
User-agent: KMail/1.5

Does it work yes, for now.  The linker simply issues a warning:
ld: Type mismatch for symbol "accept"; resolving FUNC symbol (in file 
/usr/lib/hpux32/libc.so) to OBJECT symbol (in file symtab.o)

This is true on all versions of HP-UX, at least using the native compilers.  
For some reason GCC seems to suppress this warning, but it is still an issue. 

Is it good practice to use obscure names - no, is it good practice to use 
variables named the same as functions - no. I have seen more than a few times 
where this has lead to severe problems, and not just on HP-UX.

The GNU Coding standard states: 
(http://www.ie.gnu.org/prep/standards_25.html#SEC25)
"Don't use local variables or parameters that shadow global identifiers."

K&R are even more direct: (The C programming language, Section 4.8):
"As a matter of style, it's best to avoid variable names that conceal names in 
an outer scope; the potential for confusion and error is too great."

Now these are both only style guides, but style guides do exist for a reason.

Jon


On Saturday 17 May 2003 02:04, Paul Eggert wrote:
> Jonathan Ward <address@hidden> writes:
> > accept() is defined in libc on most OSes,
>
> Sure, but generally it's a weak symbol, so if the user's program
> defines 'accept' the user's definition wins.  This is required for
> conformance to the C Standard, as I mentioned in my previous message.
> Why isn't this working for you in your environment?  Perhaps if you
> try compiling my little test program we can find out why.
>
> Other people have built Bison for HP-UX 11.00 and 11.20; see
> <http://hpux.connect.org.uk/hppd/hpux/Gnu/bison-1.875/>.  So perhaps
> this problem depends on HP-UX version.  What HP-UX version are you
> using?

-- 
Jonathan Ward
Partner Technology Access Center MA
Hewlett-Packard Company
550 King St, LKG2A-X2
Littleton, MA 01460
978.506.5338




reply via email to

[Prev in Thread] Current Thread [Next in Thread]