Re: Proper standards in writing library headers

Discussion in 'C++' started by Öö Tiib, Oct 30, 2012.

  1. Öö Tiib

    Öö Tiib Guest

    On Wednesday, 31 October 2012 00:31:31 UTC+2, Jason Benjamin wrote:
    > Hi everyone. I'm going to try to write a library header for a third
    > party library and I wanted to change some of the function names. I was
    > thinking of just wrapping the functions in new functions within the
    > header file itself.


    You can do it as long the functions you define in header are declared
    as inline.

    > I just want to know, is this an appropriate way to do this, or is there
    > some better or more acceptable way to achieve the same effect? I have
    > considered writing a proxy library, but I think that would be superfluous.


    That is hard to tell. Usually we try to add some value not only rename
    some function names (or move into namespace) by a wrapper. However if
    that is all you want to do then sounds appropriate way enough for me.
    Öö Tiib, Oct 30, 2012
    #1
    1. Advertising

  2. On 10/30/2012 04:46 PM, Öö Tiib wrote:
    > On Wednesday, 31 October 2012 00:31:31 UTC+2, Jason Benjamin wrote:
    >> Hi everyone. I'm going to try to write a library header for a third
    >> party library and I wanted to change some of the function names. I was
    >> thinking of just wrapping the functions in new functions within the
    >> header file itself.

    >
    > You can do it as long the functions you define in header are declared
    > as inline.


    I'm sorry I forgot to mention that I'm trying to write this in ANSI C,
    not C99 or C++. However, I do know that the compiler I use, gcc,
    supports inlining normally. What other compilers support inlining by
    default? Also, I'm trying to code portably, so would it even be safe to
    use inlining?
    >
    >> I just want to know, is this an appropriate way to do this, or is there
    >> some better or more acceptable way to achieve the same effect? I have
    >> considered writing a proxy library, but I think that would be superfluous.

    >
    > That is hard to tell. Usually we try to add some value not only rename
    > some function names (or move into namespace) by a wrapper. However if
    > that is all you want to do then sounds appropriate way enough for me.
    >
    Jason Benjamin, Oct 31, 2012
    #2
    1. Advertising

  3. I'm sorry, wrong newsgroup.

    On 10/30/2012 04:46 PM, Öö Tiib wrote:
    > On Wednesday, 31 October 2012 00:31:31 UTC+2, Jason Benjamin wrote:
    >> Hi everyone. I'm going to try to write a library header for a third
    >> party library and I wanted to change some of the function names. I was
    >> thinking of just wrapping the functions in new functions within the
    >> header file itself.

    >
    > You can do it as long the functions you define in header are declared
    > as inline.
    >
    >> I just want to know, is this an appropriate way to do this, or is there
    >> some better or more acceptable way to achieve the same effect? I have
    >> considered writing a proxy library, but I think that would be superfluous.

    >
    > That is hard to tell. Usually we try to add some value not only rename
    > some function names (or move into namespace) by a wrapper. However if
    > that is all you want to do then sounds appropriate way enough for me.
    >
    Jason Benjamin, Oct 31, 2012
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. J44xm
    Replies:
    12
    Views:
    643
    J44xm
    Feb 18, 2005
  2. dont bother
    Replies:
    0
    Views:
    793
    dont bother
    Mar 3, 2004
  3. Phil
    Replies:
    4
    Views:
    669
    Gabriel Genellina
    Jan 17, 2010
  4. Ian
    Replies:
    2
    Views:
    1,942
  5. still me
    Replies:
    0
    Views:
    82
    still me
    Oct 18, 2007
Loading...

Share This Page