typedef struct foo{} foo

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • JonLT
    New Member
    • Jul 2007
    • 41

    typedef struct foo{} foo

    Hi!
    I was just wondering what this means (in c++):
    [code=cpp]
    typedef struct foo{} foo;
    [/code]
    is it some way of prototyping a function as a struct, or an array as a struct or something?
    I found it in a header im using, with it im using a .lib and a .dll, so i don't known what whats really going on, but i'd like to know what the above means.
    Thanks.
    - Jon
  • JonLT
    New Member
    • Jul 2007
    • 41

    #2
    is it maybe the same as a class prototype?
    [code=cpp]
    class foo;
    [/code]

    Comment

    • JosAH
      Recognized Expert MVP
      • Mar 2007
      • 11453

      #3
      Originally posted by JonLT
      Hi!
      I was just wondering what this means (in c++):
      [code=cpp]
      typedef struct foo{} foo;
      [/code]
      It simply defines another name 'foo' for an empty struct which, incidentally, has
      the same name 'foo] as its struct tag but that's irrelevant.

      kind regards,

      Jos

      Comment

      Working...