Re: function signature "funny"
Peter Lovell <[email protected]> Sun, 12 Jun 2005 20:26:20 -0400
| Newsgroups | gmane.comp.java.vm.sablevm.devel |
|---|---|
| Message-ID | <[email protected]> |
On Jun 11, 2005, at 1:28 PM, Grzegorz B. Prokopski wrote: > On Wed, 2005-08-06 at 17:50 -0400, Peter Lovell wrote: > >> Hi folks, >> I'm trying to get all the warnings out of code we have and I ran into >> what seems to be to be an anomaly. >> >> Considering the following snippet from jni.h >> >> typedef _svmt_s8 jbyte; >> >> const jbyte *(JNICALL *GetStringUTFChars) (JNIEnv *env, jstring >> string, >> jboolean *isCopy); /* 169 */ >> void (JNICALL *ReleaseStringUTFChars) (JNIEnv *env, jstring >> string, >> const char *utf); /* 170 */ >> >> note also that jni_system_specific defines ... >> typedef signed char _svmt_s8; >> > > Unless I misread, "const jbyte" becomes "const signed char". Isn't > that > just about the same as "const char"? I mean: "const char" is signed > [*], isn't it? Am I missing something or GCC4 is overpicky here? > > >> This is throwing up a bunch of warnings using gcc 4 such as ... >> MacOSXAsset.c:234: warning: pointer targets in assignment differ in >> signedness >> > > GBP > > [*] I should probably have looked into C89 standard first, but > until the > end of the month I don't have time for that, sorry. As it turns out, there are three types of char, rather than just two as some of use expect. And yes, gcc4 is being very picky. There's signed, unsigned, and the plain-unadorned-without-any- specifier kind. So the const signed char* returned by GetStringUTFChars does not match the const [without sign specifier] char* expected by ReleaseStringUTFChars. Regards.....Peter