Linkage

This is a discussion on Linkage within the C Programming forums, part of the General Programming Boards category; I'm reading a book called Pointers on C and I believe I have found an error but I just want ...

  1. #1
    Registered User
    Join Date
    Jan 2005
    Posts
    204

    Linkage

    I'm reading a book called Pointers on C and I believe I have found an error but I just want to make sure before contacting the author. Consider this piece of code:
    Code:
    typedef char *a;
    int b;
    int c (int d)
    {
        int e;
        int f(int g);
        ...
    }
    Here's part of it's description:
    By default, the linkage of identifiers b, c, and f is external...
    Why is he saying that linkage of f is external if it is inside function c? Thanks.

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,533
    > Why is he saying that linkage of f is external if it is inside function c?
    Because it isn't static.

    There is a subtle difference between linkage and scope here - the linkage is external, but the scope is local to function c()
    Code:
    int c (int d) {
      int f(int g);
      return f(d);
    }
    
    int d ( void ) {
      return f(1);  /* this f() is implicitly declared */
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Linkage question
    By DL1 in forum C++ Programming
    Replies: 6
    Last Post: 01-13-2009, 06:56 PM
  2. Quantum Random Bit Generator
    By shawnt in forum C++ Programming
    Replies: 62
    Last Post: 06-18-2008, 10:17 AM
  3. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 04:45 PM
  4. error: template with C linkage
    By michaels-r in forum C++ Programming
    Replies: 3
    Last Post: 05-17-2006, 08:11 AM
  5. Errors with including winsock 2 lib
    By gamingdl'er in forum C++ Programming
    Replies: 3
    Last Post: 12-05-2005, 07:13 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21