Forum Index
Internal error: exception: access violation

 
Author Message
pjc30943



Joined: 02 Dec 2005

Posted: 22 August 2008, 0:07 AM    Post subject: Internal error: exception: access violation

The following code produces the error below

Code:
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...
Back to top
dkinzer
Site Admin


Joined: 03 Sep 2005
Location: Portland, OR

Posted: 22 August 2008, 2:15 AM    Post subject: Re: Internal error: exception: access violation

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:

Dim b as Byte

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

function findType(byval type as byte) as byte
  findType = type
end function
Back to top
pjc30943



Joined: 02 Dec 2005

Posted: 22 August 2008, 20:21 PM    Post subject:

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:
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:
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
Back to top
Display posts from previous:   
Page 1 of 1

 



ZBasic Microcontrollers Home
All content Copyright © 2005, 2006, 2007, 2008 Elba Corp. All Rights Reserved.
Opinions expressed in posts are those of the author and not necessarily those of Elba Corp.
Powered by phpBB © 2001, 2005 phpBB Group