<p>Am 06.10.2014 17:55 schrieb "Jürgen Hestermann" <<a href="mailto:juergen.hestermann@gmx.de">juergen.hestermann@gmx.de</a>>:<br>
><br>
> Am 2014-10-06 um 07:55 schrieb Sven Barth:<br>
><br>
> > On 06.10.2014 07:20, Jürgen Hestermann wrote:<br>
> >><br>
> >> Am 2014-10-05 um 20:21 schrieb Sven Barth:<br>
> >>> Please note that GetLastError is Windows-specific. The cross platform<br>
> >>> function in SysUtils is called GetLastOSError which does return Integer.<br>
> >> And why does a function SysErrorMessage exist that expects an INTEGER<br>
> >> and handes this over to FormatMessage which expects a DWORD?<br>
> ><br>
> > SysErrorMessage is the cross platform function while FormatMessage<br>
> > is the Windows specific implementation so the types returned/used<br>
> > by these two functions are already compatible.<br>
><br>
> This is incorrect.<br>
> SysErrorMessage expects an INTEGER while FORMATMESSAGEA is<br>
> declared to use a DWORD parameter (see code snippets at the bottom).</p>
<p>I was a bit unclear here: I talked about the return type of GetLastOSError and the parameter of SysErrorMessage.</p>
<p>><br>
><br>
> > GetLastOSError merely uses GetLastError on Windows (on Linux it<br>
> > is errno for example) and casts its DWORD result to Integer.<br>
><br>
> Again incorrect. GetLastOSError gives back an Integer and<br>
> the DWORD coming from GetLastError it directly assigned to<br>
> this integer-type Result. There is no type casting (see below).</p>
<p>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).</p>
<p>Regards,<br>
Sven</p>