Internal error: exception: access violation

Discussion about the ZBasic language including the System Library. If you're not sure where to post your message, do it here. However, do not make test posts here; that's the purpose of the Sandbox.
Post Reply
pjc30943
Posts: 220
Joined: 01 December 2005, 18:45 PM

Internal error: exception: access violation

Post by pjc30943 »

The following code produces the error below

Code: Select all

public function findType(byval type as byte) as byte

end function

"Internal error: exception: access violation"


Obviously the issue is that the restricted keyword "type" is used as a parameter name. However, the compiler does not report this...
Paul
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Re: Internal error: exception: access violation

Post by dkinzer »

pjc30943 wrote:"Internal error: exception: access violation"
With the simple test case below, I don't get an exception. I tried it on several versions of the compiler back to 2.4.3 with the same result. Can you reproduce the issue using this test case?

Code: Select all

Dim b as Byte

Sub Main()
  b = findType(3)
End Sub

function findType(byval type as byte) as byte
  findType = type
end function
- Don Kinzer
pjc30943
Posts: 220
Joined: 01 December 2005, 18:45 PM

Post by pjc30943 »

The code does not compile on my system, v. 2.5.5. It does not, in this case, give the exception, only the errors listed below. That exception still occurs when the function "findType(byval type as byte) as byte" is added into one of my modules.

However, the following does compile correctly.

Code: Select all

Dim b as Byte 

Sub Main() 
  b = findType(3) 
End Sub 

function findType(byval type1 as byte) as byte 
  findType = type1
end function
If "type" is used instead of "type1", the output is:

Code: Select all

testAccessError.bas:5: Error: function "findType" takes no parameters
testAccessError.bas:8: Error: expected '(' following function name
testAccessError.bas:9: Error: expected Sub, Function, Const, Declare, Dim or Enum
testAccessError.bas:10: Error: expected Sub, Function, Const, Declare, Dim or Enum
Paul
Post Reply