madExcept causes compilation errors in Delphi 10.2

delphi package - automated exception handling

madExcept causes compilation errors in Delphi 10.2

Postby tkunicki » Sun May 28, 2017 12:05 am

We treat uninitialized variable warning as an error which makes impossible madexcept to compile under Win64 because of invalid way of casting used which is triggering warnings now

NativeUInt(sh) := NativeUInt(mh) + sizeOf(TImageNtHeaders64)

Instead of casting left side you should cast right side to pointer this will not trigger compiler warning.

sh := Pointer(mh + sizeOf(TImageNtHeaders64))

It does not have to be typed pointer. The problem appears in madExcept.pas and in madMapFile.pas
Posts: 3
Joined: Fri Feb 19, 2016 8:41 pm

Re: madExcept causes compilation errors in Delphi 10.2

Postby pfennig59 » Sat Jun 03, 2017 10:50 am

We ran into the same problem and I too would prefer to do the casting only on the right side.

Although, it should be
sh := Pointer(NativeUInt(mh) + sizeOf(TImageNtHeaders64)) ,

otherwise you'll get an error E2015: Operator not applicable to this operand type

It also affects unit madTools.pas from the madBasic package.
Posts: 1
Joined: Sat Jun 03, 2017 10:40 am

Re: madExcept causes compilation errors in Delphi 10.2

Postby madshi » Wed Jun 14, 2017 8:56 am

Somewhat strange. These warnings don't seem to show up if I batch compile madExcept. I'm wondering why you're recompiling madExcept.pas, anyway? Why not simply using the precompiled DCUs I'm shipping with madExcept.

Anyway, I'll have a look at these warnigs. Although I have to say, they don't make sense to me. IMHO the code "NativeUInt(sh) := NativeUInt(mh) + sizeOf(TImageNtHeaders64)" is perfectly fine!
Site Admin
Posts: 10232
Joined: Sun Mar 21, 2004 5:25 pm

Return to madExcept

Who is online

Users browsing this forum: No registered users and 12 guests