On Sun, 29 Jul 2018 11:17:08 +0800, TK Chia wrote:
> I double-checked the compiler output (using `wdis test.o') for the
> malloc( ) call under the huge model, and found that it actually clips
> the size to a `size_t', and `size_t' is a 16-bit integer type even for
> the huge model.  I.e. malloc(81920) only allocates 16384 bytes.

Indeed! OpenWatcom's malloc() prototype accepts a size_t argument, even 
in the huge model, and sizeof(size_t) tells that it's a 16-bit value. 
This is extremely deceiving. I would at least expect the compiler to warn 
about argument truncation because of incompatible data type being passed.

In such case the halloc() & hfree() pair does seem to be the only way. 
Although for handling amounts of data > 64K one should definitely think 
about relying on XMS, or going the (so much easier) protected mode way.

Thanks for your research, TK Chia!

Mateusz
-- 
FreeDOS is present on the USENET, too! alt.os.free-dos


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Freedos-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freedos-devel

Reply via email to