Default Integer Pointer Values

Ty Young youngty1997 at gmail.com
Thu Oct 3 04:12:22 UTC 2019


Hi,


Recently I've stumbled upon a potential issue in regards to an allocated 
integer pointer:


Pointer<Integer> valuePointer = <Lib>.scope().allocate(NativeTypes.INT);


This basic integer pointer works fine of course. However, for some 
reason the pointer has a value already set despite never been given one. 
In potential functions that don't have proper return code values(enums, 
technically), these values could be potentially seen as valid values 
when in reality they are not. In some cases I think these values can 
even change from run-to-run, making the issue even worse.


Would the expected behavior here not be to have the wrapped value be 
NULL or is there reasons as to why it does this?



More information about the panama-dev mailing list