• 11
• 9
• 10
• 9
• 10

# The compiler crashes

This topic is 695 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello!

I found that the next small piece of code crashes the asIScriptModule Build() with Access Violation.
The code line m_callback = callback has an error obviously and should be changed to the one written in comment but still.

Many thanks!

funcdef void CALLBACK(MyParam@ param);

class MyParam {
int m_value;

MyParam(int value) {
m_value = value;
}
}

class MyClass {
CALLBACK@ m_callback;

MyClass(CALLBACK@ callback) {
m_callback = callback; // !!! MUST BE: @m_callback = @callback;
}
}

void main() {
}

##### Share on other sites

Are you using the latest WIP version from the SVN? I've already fixed a bug like this in the latest WIP version.

Anyway, I'll make sure to test this too with the WIP to make sure it truly is fixed.

Regards,

Andreas

##### Share on other sites

Hello Andreas!

Are you using the latest WIP version from the SVN? I've already fixed a bug like this in the latest WIP version.

Anyway, I'll make sure to test this too with the WIP to make sure it truly is fixed.

No, I use 2.31.0 with JIT.

As the problem isn't annoying I may wait till 2.32.0.

Thank you very much for such a good library!!!

(I compared the functionality with Lua and ChaiScript: in my opinion AngelScript is the best)

##### Share on other sites

As I suspected. This problem had already been fixed in the latest WIP version.

Thanks for the compliments on the library. Let me know if you encounter any other problems, or have any suggestions for how to improve the library further.

Regards,

Andreas

##### Share on other sites

Hello Andreas!

As I suspected. This problem had already been fixed in the latest WIP version.

Thanks for the compliments on the library. Let me know if you encounter any other problems, or have any suggestions for how to improve the library further.

Good to know that it's fixed already!

Regarding library improvement:

It's good to have more accurate info about source code positions in compiler error messages.
When AS source code uses tabs for indentation the '\t' char is now treated by the compiler as a single symbol

but in editor it may cover 2, 4 or even 8 symbols.
So something like

pEngine->SetEngineProperty(asEP_TAB_CHARACTER_SIZE, 4);

would be very good feature (in my opinion).
And if the default is 1 this change wont break any existing code.

Thanks a lot!

##### Share on other sites

I don't feel that this translation of tab chars to columns belongs in the compiler layer. One simple reason is that the compiler has no way of knowing if is compiling the original code or some code that has been pre-processed (for example to expand macros, etc).

##### Share on other sites

I don't feel that this translation of tab chars to columns belongs in the compiler layer. One simple reason is that the compiler has no way of knowing if is compiling the original code or some code that has been pre-processed (for example to expand macros, etc).

Well I don't know what's better but for example gcc/g++ 5.x assumes that tab size is 4 by default.

Also for preprocessor it has -ftabstop=width  option.

But any solution with such a translation is better than counting tabs as 1.

Thanks!