[Gnucash-changes] QOF/CashUtil Sync: Engine

Derek Atkins warlord at MIT.EDU
Wed Aug 17 07:49:39 EDT 2005


Neil,

Just started looking over this patch, and I have one question
that came up REALLY QUICKLY:

Neil Williams <codehelp at cvs.gnucash.org> writes:

> --- src/engine/Scrub2.c
> +++ src/engine/Scrub2.c
> @@ -324,7 +324,7 @@
>     KvpFrame *ksub;
>  
>     /* Find and remove the matching guid's */
> -   ksub = gnc_kvp_bag_find_by_guid (sa->kvp_data, "lot-split",
> +   ksub = (KvpFrame*)gnc_kvp_bag_find_by_guid (sa->kvp_data, "lot-split",
>                      "peer_guid", &sb->entity.guid);
>     if (ksub) 
>     {
> @@ -333,7 +333,7 @@
>     }
>  
>     /* Now do it in the other direction */
> -   ksub = gnc_kvp_bag_find_by_guid (sb->kvp_data, "lot-split",
> +   ksub = (KvpFrame*)gnc_kvp_bag_find_by_guid (sb->kvp_data, "lot-split",
>                      "peer_guid", &sa->entity.guid);
>     if (ksub) 


Why did you add these casts?  The prototype of
gnc_kvp_bag_find_by_guid() already returns a KvpFrame, so there should
be no need to cast it.  Is there something you know that I don't?

Remember: CASTS ARE BAD.  Casting can hide real errors.  You should
never cast unless you really know what you're doing, because it will
bite you later when you change a function prototype.

-derek

-- 
       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord at MIT.EDU                        PGP key available


More information about the gnucash-devel mailing list