Re: [HACKERS] c language functions

2013-04-03 Thread Rodrigo Barboza
I see, that's true. I'm returning unknown type, there is a little more overhead. But it's working now. =] Thanks for the help guys! On Wed, Apr 3, 2013 at 6:17 PM, Robert Haas wrote: > On Wed, Apr 3, 2013 at 3:25 PM, Rodrigo Barboza > wrote: > > Well, I was checking inside my function the type

Re: [HACKERS] c language functions

2013-04-03 Thread Robert Haas
On Wed, Apr 3, 2013 at 3:25 PM, Rodrigo Barboza wrote: > Well, I was checking inside my function the type of the second argument and > switching between the allowed types. > This way kind of does the same thing of many functions, doesn't it? Sure, except that it will also call your function when

Re: [HACKERS] c language functions

2013-04-03 Thread Rodrigo Barboza
Well, I was checking inside my function the type of the second argument and switching between the allowed types. This way kind of does the same thing of many functions, doesn't it? On Wed, Apr 3, 2013 at 3:39 PM, Tom Lane wrote: > Rodrigo Barboza writes: > > Why not useful? > > If I don't make

Re: [HACKERS] c language functions

2013-04-03 Thread Tom Lane
Rodrigo Barboza writes: > Why not useful? > If I don't make it receive anyelement, I will have to create an add > function for each type. If you make it anyelement, then you're contracting to be able to add any datatype whatsoever to a my_uint. This is nonsensical. You'd be better off declaring

Re: [HACKERS] c language functions

2013-04-03 Thread Rodrigo Barboza
Why not useful? If I don't make it receive anyelement, I will have to create an add function for each type. Correct me if I'm wrong. On Wed, Apr 3, 2013 at 2:27 PM, Robert Haas wrote: > On Wed, Apr 3, 2013 at 11:26 AM, Rodrigo Barboza > wrote: > > Hello. > > I'm trying to create a generic add

Re: [HACKERS] c language functions

2013-04-03 Thread Robert Haas
On Wed, Apr 3, 2013 at 11:26 AM, Rodrigo Barboza wrote: > Hello. > I'm trying to create a generic add function. > I have defined a type my_uint and it needs a '+' operator. > This operator should work like normal int + int operation. > The function is defined expecting arguments (my_uint, anyeleme

[HACKERS] c language functions

2013-04-03 Thread Rodrigo Barboza
Hello. I'm trying to create a generic add function. I have defined a type my_uint and it needs a '+' operator. This operator should work like normal int + int operation. The function is defined expecting arguments (my_uint, anyelement). I'm confused in retrieving the anyelement type, value and tha