gm2
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Type safety in GM2?


From: Hưng Hưng
Subject: Type safety in GM2?
Date: Tue, 24 Mar 2020 20:35:51 +0700

I found I can't substitute C typed pointer which I don't know how to translate to GM2 with ADDRESS. But the problem arise that when I declare them as ADDRESS I could pass anything to them and the compiler doesn't complain but the resulted program will crash.

e.g: the library assumes the passed type to be a structure typedef-ed with void pointer that I don't know how to translate to GM2 so I substitute it with ADDRESS, but I found I could pass an INTEGER pointer to it without any complains from the compiler but my program would crash.

How to at least tell the compiler to check if the correct type was passed or is it impossible without a properly translated type to GM2?

I found the developers also used this trick heavily. Check ncurses.def and you will see they also substitute pointer to not translated structure with ADDRESS.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]