Compiling errors on F11 64-bit; question on sending in patch files

Christian Stimming stimming at tuhh.de
Sun Jul 19 16:30:52 EDT 2009


Hi Alex,

thanks for pointing this out. Apparently you've run into one very nasty thing 
in the C language: It is unspecificed whether a "char" is signed or not. That 
is, in one compiler a "char" is a "signed char" whereas on another compiler 
it is an "unsigned char".

Am Sonntag, 19. Juli 2009 21:12 schrieb J. Alex Aycinena:
> In function ‘dateSeparator’:
> /home/gnucash-dev/svncheckouts/gnucash-clean/src/libqof/qof/gnc-date.c:831:
> error: pointer targets in passing argument 1 of ‘qof_strftime’ differ
> in signedness
> /home/gnucash-dev/svncheckouts/gnucash-clean/src/libqof/qof/gnc-date.h:362:
> note: expected ‘gchar *’ but argument is of type ‘unsigned char *’

This unspecified issue is okay as long as one value can be converted into the 
other automatically, but the newer compilers don't accept an automatic 
conversion of a "signed char" into a pointer to "unsigned char", which is 
what would be required if your particular compiler has "gchar" defined 
as "signed char".

In this case, the actual long-term solution is to replace the "unsigned char" 
by a "gchar". In gnc-date.c:831 this seems to be rather easy. This is clearly 
preferred to a bunch of casts. If you have enough time to implement the type 
change, a patch for this would indeed be very welcome.

Regards,

Christian


> ....
>
> If I change configure to "--disable-error-on-warning " and
> "--enable-compile-warnings=no" it builds and runs fine.
>
> I was able to get the make to work with the original configure by
> putting in casts in the source to get past this warning, and then
> subsequently similar ones in another 23 source files. The resulting
> build seems to work OK, although I didn't thoroughly test it.
>
> My question to the developers is this: is putting in casts like this
> an appropriate and adequate way to deal with this? If so, I can send
> in patch files for the 24 source files I patched to get the compile to
> work. Please let me know if this OK or if further work is needed.
>
> Thanks,
>
> Alex
> _______________________________________________
> gnucash-devel mailing list
> gnucash-devel at gnucash.org
> https://lists.gnucash.org/mailman/listinfo/gnucash-devel


More information about the gnucash-devel mailing list