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.
An Internal Error is generated when the ZBasic compiler encounters a situation that it cannot handle. This is different from a syntax error or a semantic error which arises because an error in your code. Usually, it arises because some data element in an internal datastructure is missing or inconsistent with other data elements. In such cases, we chose to emit the Internal Error rather than to continue using bad data.
Normally, such errors should not arise. When they do, it means that either there is a coding error in the compiler or we neglected to handle a certain set of circumstances. The challenge is to locate the source of the error - often the ultimate source of the error is far removed from the point at which the problem is detected. We will attempt to reproduce the problem here using a simplified test case although this is often unsuccessful. If you can send us source code that exhibits the problem (either your full source code or a simplified test case) that will expedite locating and resolving the problem.
victorf wrote:While compiling the program WindReader.bas, I received the following error message:
I don't know yet why the problem is occurring but it appears that you can work around it by temporarily replacing the code on lines 357 through 361 of WindReader.bas with the following:
victorf wrote:I'll be interested in hearing what you find after the investigation.
The short answer is that the problem was caused by a coding error in one of the methods of a C++ class that represents a structure member reference.
The longer answer is that code is generated for the DegToRad() function (and a few similar functions) in a special way where a new expression is constructed using a conversion factor together with the parameter provided. The C++ method for duplicating an expression element for the class that represents the structure member reference wasn't implemented correctly. This led to an inconsistency in the expression which was discovered later in the code generating process resulting in the Internal Error that you saw.
We've resolved the error and augmented the test suite to cover this and related situations.
I replaced this in both expressions as well using the same method as you suggested for sensordata.azimuth for the sake of symmetry. Everything works fine now.
Thanks again
Vic
Vic Fraenckel
KC2GUI
windswaytoo ATSIGN gmail DOT com