Derek Atkins wrote:
[EMAIL PROTECTED] writes:

3) in src/register/ledger-core/split-register.c , some function return values
are being typecast yet ignored.  I found that quite strange, but simply created
a variable to which the return value could be assigned:

 --- src/register/ledger-core/split-register.c   2006-01-12 22:09:58.000000000 
-0500
+++ ../split-register.c 2006-01-12 22:02:45.000000000 -0500
@@ -1331,6 +1331,7 @@
    const char *memo;
    const char *desc;
    Split *split;
+   Account * acct;

    if (!reg) return FALSE;

@@ -1389,8 +1390,8 @@
      return FALSE;

    /* Validate the transfer account names */
-   (void *)gnc_split_register_get_account (reg, MXFRM_CELL);
-   (void *)gnc_split_register_get_account (reg, XFRM_CELL);
+   acct = gnc_split_register_get_account (reg, MXFRM_CELL);
+   acct = gnc_split_register_get_account (reg, XFRM_CELL);


I suspect these are supposed to be (void), not (void *)...  I'd have
to look at the code to understand why it's ignoring the return value
of these functions.


I would suspect so too, but I recently learned in another project that casting the result of functions to (void) is not portable. In particular Sun's and SGI's compilers don't like that technique. Perhaps that doesn't matter to gnucash if it is gcc only?

Assigning to a variable of the right type is probably better (more portable), but I'm a bit surprised that you are not seeing: "warning: value computed is not used" instead? Thats perhaps becasue I don't properly understand the warning in the other project.

John
_______________________________________________
gnucash-devel mailing list
[email protected]
https://lists.gnucash.org/mailman/listinfo/gnucash-devel

Reply via email to