Bug 17656

Summary: <arpa/nameser.h> conflicts with C++ "class" reserverd word
Product: Base System Reporter: rse <rse>
Component: miscAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 3.4-RELEASE   
Hardware: Any   
OS: Any   

Description rse 2000-03-29 07:30:01 UTC
I've tried to compile lftp (http://ftp.yars.free.net/projects/lftp/)
and its Resolver.cc includes <arpa/nameser.h>. Because it's a 
C++ source file, the header has to pass the same C++ compiler.
Unfortunately in /usr/include/arpa/nameser.h there
is a definition of ns_rr which contains a field named "class".
This obviously conflicts with the C++ reserved word "class".
I worked around the problem by using "#define class dummy"
and "#undef class" around the "#include <arpa/nameser.h>", of course.
But as a long-term solution one should fix <arpa/nameser.h>,
because it will cause trouble in the future with C++ compilers again.
I think we just can rename the field name, because it is already
used only through accessor macors, here ns_rr_class().

Fix: 

Rename the field name and adjust the ns_rr_class() macro
accordingly to use new name.
How-To-Repeat: include <arpa/nameser.h> in a C++ program.
Comment 1 Jacques Vidrine freebsd_committer freebsd_triage 2000-03-30 22:00:55 UTC
State Changed
From-To: open->closed

Duplicate PR, see misc/11670.