proper format for printing GetLastError()

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: proper format for printing GetLastError()
Date: 2011-07-04 15:29:05
Message-ID: 1309793345.2447.6.camel@vanquo.pezone.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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?

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2011-07-04 15:53:43 Re: Latch implementation that wakes on postmaster death on both win32 and Unix
Previous Message Alvaro Herrera 2011-07-04 15:12:32 Re: Potential NULL dereference found in typecmds.c