CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Threaded View

  1. #1
    Join Date
    Jul 2009
    Posts
    9

    Question Inline (strange behavior)

    hello to everyone,

    1)
    if i declare a function in a header file like this :

    void Foo() { /* code here*/}

    the linker will fail due to multiple definition !!! (Foo already defined in Myclass.obj)

    2)

    but if i declare it like this :

    inline void Foo() { /* code here*/}

    it compiles normally.

    So here is the questions :

    a) since i declared the function in the header file, isnt it by default inline ?
    Why do i have to specify the inline keyword again ?

    b) what if a compiler decides to ignore the inline keyword ? will it result in multiple definition during link time ?

    thank you,
    Last edited by anonymous12345; February 11th, 2010 at 03:35 PM. Reason: typo

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured