Re: InvalidOid & C++
От | Jeroen T. Vermeulen |
---|---|
Тема | Re: InvalidOid & C++ |
Дата | |
Msg-id | 20030318170019.GB32109@xs4all.nl обсуждение исходный текст |
Ответ на | Re: InvalidOid & C++ ("Nigel J. Andrews" <nandrews@investsystems.co.uk>) |
Список | pgsql-patches |
On Tue, Mar 18, 2003 at 01:54:17AM +0000, Nigel J. Andrews wrote: > > > How widespread is Oid(0) in C++? I have never seen anything like that. > > It looks like a function call! > > It is, sort of, probably. Looks like a constructor of an instance of type > Oid. Certainly valid C++ I think, at least I'm sure something like > int(0) should work but then this is trawling through my memory somewhat. That's right, it's a perfectly normal constructor. This is the standard way of converting one type into another without going to such radical measures as casting. > As I don't know anything about this old style cast warning I can't say > which is supposed to be more acceptable. C++ introduces new types of casts that are more specialized and well-defined than the C-style "sledgehammer" casts: const_cast<type>(value) // (add/remove consts) static_cast<type>(value) dynamic_cast<type>(value) reinterpret_cast<type>(value) // (nasty) In this case, however, no cast is required since an Oid can simply be constructed from the number 0. This is standard. Perfectly normal. Everyday practice. Straight out of the manual, both now and 15 years ago. Nothing unusual. Acceptable in polite conversation. Probably legal in most countries of the world. Non-carcinogenic. Safe for children of all ages. No assembly required. Full warranty. No strings attached. Safe. Jeroen
В списке pgsql-patches по дате отправления: