Re: datum passed to macro which expects a pointer
От | Gavin Sherry |
---|---|
Тема | Re: datum passed to macro which expects a pointer |
Дата | |
Msg-id | 20080412225755.GG26250@europa.idg.com.au обсуждение исходный текст |
Ответ на | Re: datum passed to macro which expects a pointer (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: datum passed to macro which expects a pointer
Re: datum passed to macro which expects a pointer |
Список | pgsql-patches |
On Sat, Apr 12, 2008 at 06:02:39PM -0400, Tom Lane wrote: > Gavin Sherry <swm@alcove.com.au> writes: > > This may seem a little pedantic but I noticed a few places where we pass > > a datum to a macro which treats the datum as a pointer. This works now > > but might not in the future (if, say, Datum were to be 8 bytes). > > Yeah, definitely something to fix. I think though that the cases > like this: > > > ! PG_RETURN_TEXT_P(DatumGetPointer(result)); > > might as well just use PG_RETURN_DATUM instead of casting twice. Oh of course. Updated patch attached. > > Was this just eyeball inspection or did you find a compiler that would > complain about this? I wish. It was actually thrown up when we (Greenplum) changed the macros to be inline functions as part of changing Datum to be 8 bytes. By using inline functions we get proper type checking from the compiler and since we have only a small number of target platforms and architectures, inlining isn't an issue. Thanks, Gavin
Вложения
В списке pgsql-patches по дате отправления: