Menu

#815 Code for checking null pointer (-exx compile option) not added on (*ptr).field

open
nobody
None
compiler
2016-02-20
2016-02-20
No

For a dereferenced pointer inside an expression with the operator '.' (to access member):
(*ptr).field
the -exx compiler option seems to not add code for null-pointer checking, because the runtime error is "segmentation violation" and not "null pointer access".
(the interest of this option is to get the line number in question)

Type UDT
  Dim As Integer I = 123
End Type

Dim As UDT Ptr pu
Print pu->I    '' Aborting due to runtime error 7 (null pointer access) at line 6
Print (*pu).I  '' Aborting due to runtime error 12 ("segmentation violation" signal)

Discussion


Log in to post a comment.

MongoDB Logo MongoDB