Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Function prototypes

Reply
Thread Tools

Function prototypes

 
 
Jimpolar
Guest
Posts: n/a
 
      08-24-2007
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
 
Reply With Quote
 
 
 
 
Ben Pfaff
Guest
Posts: n/a
 
      08-24-2007
Jimpolar <(E-Mail Removed)> writes:

> 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.


Assuming that mvprintw doesn't actually modify 'fmt', I'd just
use a cast.
--
"A lesson for us all: Even in trivia there are traps."
--Eric Sosman
 
Reply With Quote
 
 
 
 
Keith Thompson
Guest
Posts: n/a
 
      08-24-2007
Jimpolar <(E-Mail Removed)> writes:
> Well I have a design question in regards to using

[snip]
> ================================================== ===============
> My conviction comes down to this:

[snip]
> === GW Bush, 2005


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 (The_Other_Keith) http://www.velocityreviews.com/forums/(E-Mail Removed) <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
function prototypes and function addresses Syren Baran C Programming 6 01-09-2008 06:34 PM
Re: Can function prototypes appear anywhere? Lawrence Kirby C Programming 2 01-24-2005 04:56 PM
Re: Can function prototypes appear anywhere? Chris Dollin C Programming 3 01-19-2005 06:01 PM
order of const in function prototypes Denis Remezov C++ 7 06-30-2004 11:41 AM
New to Python; what about #include, extern and function prototypes Bo Jacobsen Python 6 03-07-2004 02:37 PM



Advertisments