[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-pim
Subject: Re: [Kde-pim] out of memory
From: Mark Bucciarelli <mark () easymailings ! com>
Date: 2005-05-26 14:31:15
Message-ID: 4295DDB3.3010000 () easymailings ! com
[Download RAW message or body]
David Faure wrote:
>On Thursday 26 May 2005 15:32, Mark Bucciarelli wrote:
>
>
>>In C, I'm used to checking that malloc returns a non-null pointer to
>>make sure you app is not out of memory.
>>
>>How do you do this in C++?
>>
>>
>
>This was discussed some time ago, and the consenssus was that in KDE code,
>we don't check for out of memory, and we don't need to.
>
Makes sense. Because of how the OS' work, checking the rval of malloc
doesn't even seem useful.
Follow up question---is there similar consensus on error handling?
I'm working on dcop iface and I am falling back to my C ways of having
methods return an integer--0 for success, positive integer for error; e.g.,
#!/bin sh
RVAL=`dcop karm-123 dcopiface booktime libkcal-uid 20050505T1050 360`
if [ "$RVAL" -gt "0" ]
then
echo `dcop karm-123 dcopiface geterror $RVAL`
exit $RVAL
fi
It's nice b/c if you use this consistently, then you can bubble up all
kinds of errors, add more detail later as the library grows and morphs:
invalid resource, lock failed, async resource currently locked, bad task
UID, confused resource manager, etc.
But most libkcal fcn's seem to simply return a true or false, and give
little info on the specific error. (I did see one use of kdError (sp?)).
So, is this approach (non-boolean rvals) also considered a waste of time?
m
_______________________________________________
kde-pim mailing list
kde-pim@kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
kde-pim home page at http://pim.kde.org/
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic