Function prototypes

Discussion in 'C Programming' started by Jimpolar, Aug 24, 2007.

  1. Jimpolar

    Jimpolar Guest

    Well I have a design question in regards to using
    const char * for data that I am not modifying
    that I pass to a function.

    Given this prototype:
    int mvprintw(int y, int x, char *fmt [, arg] ...);

    for the format string it wants the type pointer to char
    but I have a wrapper around this function and the wrapper's
    prototype for the format string is const char *

    I don't really want to use char * because I am not modifying
    the contents of the format string, ever.

    Any suggestions on what I should do? seems the only solution
    is to use char * for my wrapper but I could cast, however
    this is even more revolting than just using char *.


    =================================================================
    My conviction comes down to this:
    we do not create terrorism by
    fighting the terrorists. We invite
    terrorism by ignoring them. And we
    will defeat the terrorists by
    capturing and killing them abroad,
    removing their safe havens and
    strengthening new allies like Iraq
    and Afghanistan in the fight we
    share.
    === GW Bush, 2005
     
    Jimpolar, Aug 24, 2007
    #1
    1. Advertisements

  2. Jimpolar

    Ben Pfaff Guest

    Assuming that mvprintw doesn't actually modify 'fmt', I'd just
    use a cast.
     
    Ben Pfaff, Aug 24, 2007
    #2
    1. Advertisements

  3. The correct delimiter for a signature is "-- " on a line by itself.
    Using a line of '=' characters makes the quotation look like it's part
    of the article.

    You're using slrn; it should do this for you automatically if you put
    your signature in "$HOME/.signature".

    You can put whatever you like in your signature; political discussions
    in the body of the article are frowned upon here.
     
    Keith Thompson, Aug 24, 2007
    #3
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.