The Palm R7 compiler is a lot stricter than previous compilers about implicit
type conversions. If I remember it was added for stricter ANSI compliance; in
addition this is useful in catching some errors which might have occurred as a
result of such implicit type conversions by forcing you to explicitly cast it.
In your case, you will have to explicitly cast your call to MyCall e.g.
MyCall ((const char**)&myPointer);
-- jkl
----- Original Message -----
From: "Jeffrey Pahren" <[EMAIL PROTECTED]>
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent: Wednesday, June 06, 2001 4:14 PM
Subject: Re: Forcing const char *
> A colleague of mine seems to have found the answer for me. Even though
> it doesn't make sense, the error appears to support ANSI. There is
> a discussion at:
>
> www.egr.unlv.edu/~ftlofaro/computers/ansi-bogosity.txt
>
> -jeffp
>
>
> > Actually, I've reviewed this a little more closely, and found
> > one difference that may be significant, even though it
> > shouldn't be. My code is actually:
> >
> > void MyCall(const char ** x);
> >
> > void my_fun()
> > {
> > char myPointer[50];
> >
> > ...
> >
> > MyCall(&myPointer);
> > ...
> >
> > return;
> > }
> >
> > I'm passing a pointer to a char *. Does anyone
> > know why the compiler fails this?
> >
> >
> > > This thread was opened a long time ago, but I hit an issue
> > > related to it today--this thread is the closest I could find
> > > in the archives:
> > >
> > > >> ... I have an API call which requires a const char *x,
> > > >> how do I pass the variable myString in the function call ...
> > > >
> > > > hehe.. this dont work?
> > > >
> > > > APICall( (const char *) myPointer );
> > > >
> > > > ???
> > >
> > > Why is the "const" in "(const char *)" needed?
> > >
> > > basically, what I want to do is:
> > >
> > > void APICall(const char * x);
> > >
> > > void my_fun()
> > > {
> > > char myPointer[50];
> > >
> > > ...
> > >
> > > APICall(myPointer);
> > >
> > > ...
> > >
> > > return;
> > > }
> > >
> > >
> > > I understand that the reverse would be true--I shouldn't pass a
> > > const char * to a routine that would modify it, but in this case
> > > I'm passing a char * to a routine that is basically promising not
> > > to modify it--but APIcall() doesn't really care if the variable passed
> > > in is const or not.
> > >
> > > I've got code like this all over in CW R6 that worked fine (and also
> > > on other compilers, too), but now I get compiler errors in CW R7.
> > > Is there a way to turn off that error?
> > >
> > >
> > > thanks
> > >
> > > Jeff Pahren
> > > Franklin Electronic Publishers, Inc.
> > >
> > >
> > >
> > >
> > > --
> > > For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/tech/support/forums/
> > >
> >
> > --
> > For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/tech/support/forums/
> >
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe, please
see http://www.palmos.com/dev/tech/support/forums/
>
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/