bmx-ng / bcc

A next-generation bcc parser for BlitzMax
zlib License
33 stars 12 forks source link

Release() expects "int" but uses "size_t" internally #573

Open GWRon opened 3 years ago

GWRon commented 3 years ago

When using the "release" command it expects an integer parameter.

BCC relays it to TReleaseStmt (stmt.bmx) which relays to _trans.TransReleaseStmt which then calls bbHandleRelease.

bbHandleRelease is defined in blitz.mod/blitz_handle.c (and .h) and it is defines as:

void        bbHandleRelease( size_t handle );

As NG now has "size_t" support ... shouldn't the release command now expect a size_t too?

This aside - and "ignoring" backwards compatibility I would think that the command should better be named ReleaseHandle - as it fits better to the blitz.mod/blitz.bmx commands HandleFromObject and HandleToObject.

HurryStarfish commented 3 years ago

Apparently, the NG implementation of HandleFromObject just returns the address of the object... so yeah, if these commands still use Ints, then this could definitely create problems in 64bit builds.

This aside - and "ignoring" backwards compatibility I would think that the command should better be named ReleaseHandle

That may be true, but honestly, backwards compatibility is the only valid reason for this handle stuff to still exist, and a weak one at that. It's one of those features that were already obsolete when BlitzMax was released, but got included for people who wanted to pretend they were still using BlitzBasic for some reason. Imo the only big change worth making to it at this point is to remove it.