Generally speaking, Ada will raise a Constraint_Error
if you attempt to dereference a null pointer (access type). However, this behavior is disabled if, for example, you have pragma Suppress (all_checks)
in use.
Given this scenario, how would one go about checking to see if the access type points to 0x0
(null)?
Consider the following:
type My_Access_Type is access all My_Type'Class;
procedure myProcedure ( myAccess : in My_Access_Type ) is
begin
-- need to have check in here
end
if myAccess = null then
...
end if;
Although it won't necessarily point to 0x0. Access types are not pointers, and may be implemented in a different way than plain addresses.
Collected from the Internet
Please contact javaer1[email protected] to delete if infringement.
Comments