Am 06.10.2014 17:55 schrieb "Jürgen Hestermann" <juergen.hesterm...@gmx.de>: > > Am 2014-10-06 um 07:55 schrieb Sven Barth: > > > On 06.10.2014 07:20, Jürgen Hestermann wrote: > >> > >> Am 2014-10-05 um 20:21 schrieb Sven Barth: > >>> Please note that GetLastError is Windows-specific. The cross platform > >>> function in SysUtils is called GetLastOSError which does return Integer. > >> And why does a function SysErrorMessage exist that expects an INTEGER > >> and handes this over to FormatMessage which expects a DWORD? > > > > SysErrorMessage is the cross platform function while FormatMessage > > is the Windows specific implementation so the types returned/used > > by these two functions are already compatible. > > This is incorrect. > SysErrorMessage expects an INTEGER while FORMATMESSAGEA is > declared to use a DWORD parameter (see code snippets at the bottom).
I was a bit unclear here: I talked about the return type of GetLastOSError and the parameter of SysErrorMessage. > > > > GetLastOSError merely uses GetLastError on Windows (on Linux it > > is errno for example) and casts its DWORD result to Integer. > > Again incorrect. GetLastOSError gives back an Integer and > the DWORD coming from GetLastError it directly assigned to > this integer-type Result. There is no type casting (see below). There is nevertheless an implicit typecast performed by the compiler even if in the end it's just a "mov" instruction (or something along that line). Regards, Sven
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal