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

J. Alex Aycinena alex.aycinena at gmail.com
Sun Jul 19 20:20:07 EDT 2009


Hi Christian,

2009/7/19 Christian Stimming <stimming at tuhh.de>:
> 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

Yes, in this particular case I had actually changed the actual typing
of the variable when declared rather than cast it later where it was
used, and that worked - which sounds like the approach you say is
preferable. In two other cases this also worked. But in a forth case
(qsf-xml-map.c:340) changing the type of the 'assigned to' variable,
earlier when it was declared, did solve the initial warning but, not
surprisingly, created others due to newly generated type mismatches
(which could cascade into a lot of work to change all instances).

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

I'll go through the 24 files and send in patches for the ones where
changing the type works cleanly. For the others, however many they may
be, perhaps we can discuss on a case-by-case basis. I do notice that
there already are a large number of casts (e.g., 'BAD_CAST
MAP_E_TYPE') all around. Perhaps some more in a few cases would be OK.

> Regards,
>
> Christian
>
>
 Regards,

Alex


More information about the gnucash-devel mailing list