Re: [HACKERS] proper format for printing GetLastError()
Yeah, I noticed that myself recently. On 6 July 2011 12:48, Magnus Hagander wrote: > Nope. I think it's only in there because of lazyness, in general. %lu > seems to be the correct choice. Yes, it's the correct choice. >> Thirdly, why are we not trying to print a textual message? > > I'd say that depends on where it is. In some cases probably because > it's "can never happen" messages. In other cases because, well, no > reason :) I'd also say it has something to do with the win32 API being as ugly and counter-intuitive as it is. Take a look at this: http://msdn.microsoft.com/en-us/library/ms680582(v=VS.85).aspx -- Peter Geoghegan http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training and Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
Re: [HACKERS] proper format for printing GetLastError()
On Mon, Jul 4, 2011 at 17:29, Peter Eisentraut wrote: > About half of our code prints GetLastError() using %d after casting it > to int (actually, about half of that half uses %i, another thing to sort > out, perhaps), and the other half uses %lu without casting. I gather > from online documentation that GetLastError() returns DWORD, which > appears to be unsigned 32 bits. So using %lu appears to be more > correct. Any arguments against standardizing on %lu? Nope. I think it's only in there because of lazyness, in general. %lu seems to be the correct choice. > Secondly, it might also be good if we could standardize on printing > > actual message: error code %lu > > instead of just > > actual message: %lu Or "actual error code: %lu"? > Thirdly, why are we not trying to print a textual message? I'd say that depends on where it is. In some cases probably because it's "can never happen" messages. In other cases because, well, no reason :) -- Magnus Hagander Me: http://www.hagander.net/ Work: http://www.redpill-linpro.com/ -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
[HACKERS] proper format for printing GetLastError()
About half of our code prints GetLastError() using %d after casting it to int (actually, about half of that half uses %i, another thing to sort out, perhaps), and the other half uses %lu without casting. I gather from online documentation that GetLastError() returns DWORD, which appears to be unsigned 32 bits. So using %lu appears to be more correct. Any arguments against standardizing on %lu? Secondly, it might also be good if we could standardize on printing actual message: error code %lu instead of just actual message: %lu Thirdly, why are we not trying to print a textual message? -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers