Function prototypes

J

Jimpolar

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
 
B

Ben Pfaff

Jimpolar said:
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.
 
K

Keith Thompson

Jimpolar said:
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.
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top