Thread: Possible name clash using GCC 9.1.0 between function and stuct name

  1. #1
    Registered User
    Join Date
    May 2009
    Posts
    4,183

    Possible name clash using GCC 9.1.0 between function and stuct name

    I am building an old version of GCC (4.6.4) using GCC 9.1.0.

    And, the error looks like a name clash error to me.

    I was wondering what the C standard says about structure names and function names can they be the same.

    The error does not happen with an GCC 8.?.? or it might have been GCC 7.?.?.

    Code:
    pretty-print.h:314:6: error: 'cgraph_node' is not defined as a type
    Tim S.
    Last edited by stahta01; 07-02-2019 at 08:04 PM.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    I believe the tag namespace is separate, so struct cgraph_node would not conflict with a function named cgraph_node. On the other hand, perhaps it would be a better idea to use a different function name of the verb variety, like create_cgraph_node, but perhaps the gcc authors had some convention going on. If you use a typedef for the struct though, then there would be a name collision, but that should have happened in earlier versions of gcc too.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Function name clash?
    By sethjackson in forum C++ Programming
    Replies: 17
    Last Post: 05-21-2008, 05:10 AM
  2. gets() and scanf() clash?
    By david_london69 in forum C Programming
    Replies: 4
    Last Post: 11-26-2005, 12:28 PM
  3. stuct (or something) help...
    By Rune Hunter in forum C++ Programming
    Replies: 3
    Last Post: 10-19-2004, 04:27 PM
  4. Graphics Devices and Cprintf clash
    By etnies in forum C Programming
    Replies: 6
    Last Post: 05-09-2002, 11:14 AM

Tags for this Thread