Re: Structures thought question
- From: "Havoc Pennington" <hp pobox com>
- To: "Robert Collins" <robertc robertcollins net>
- Cc: Owen Taylor <otaylor redhat com>, language-bindings gnome org
- Subject: Re: Structures thought question
- Date: Sat, 15 Nov 2008 22:05:48 -0500
Hi,
On Sat, Nov 15, 2008 at 9:51 PM, Robert Collins
<robertc robertcollins net> wrote:
> On Sat, 2008-11-15 at 21:28 -0500, Havoc Pennington wrote:
>>
>> > void gdk_region_union (GdkRegion *source1,
>> > const GdkRegion *source2);
>>
>> I would expect "inout source1" as "this" and "in source2"
>>
>> source1.union(source2);
>
> I would have expected a union operation to be a three parameter:
> result = source1.union(source2);
>
> (like +, - and other operators).
>
> Not really on-topic I know - sorry :)
Right, I mean that's more an issue with the C API than with how we bind it ;-)
gdk_rectangle_union() is done as 3 parameters:
void gdk_rectangle_union(const GdkRectangle *src1,
const GdkRectangle *src2,
GdkRectangle *dest);
I guess this would come out as:
dest = src1.union(src2);
If it's "in src1, in src2, out dest"
Though in C the intent is that "dest" is often the same as one of the
sources, so this ends up kind of inconvenient; you'd have to do:
dest = src1.union(src2);
src1.set(dest);
Alternatively, if we declared 'dest' to be inout, you could do:
src1.union(src2, src1);
But, having dest be inout seems kind of bogus, since it isn't (its
initial value is irrelevant).
Havoc
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]