Acknowledged

Feature-request: add pre-processor with inline functions to Monkey C

Please consider adding some pre-processor to Monkey C, similar to C.

For example we could have inline functions. It would make developers life much easier: the readability of the code would improve, in many cases the binary size could be decreased  litte-bit.

#inline function myfunc(a) {return App.getApp().getProperty("LeftGoalType") == GOAL_TYPE_FOO || App.getApp().getProperty("RightGoalType") == GOAL_TYPE_FOO;}

or:

#inline myfunc(a) App.getApp().getProperty("LeftGoalType") == GOAL_TYPE_FOO || App.getApp().getProperty("RightGoalType") == GOAL_TYPE_FOO

Parents
  • Just to mention it, from what I recall, some kind of optimizations are already there in the current (stock) compiler. At least things like if (xxx) { } where xxx is defined to be literal false makes the code in the body never included in the binary (this helps me a lot with eliminating all but essential code from builds for low-memory devices). Combined with (custom) annotations, this quite often makes it quite on par feature-wise with a preprocessor.

Comment
  • Just to mention it, from what I recall, some kind of optimizations are already there in the current (stock) compiler. At least things like if (xxx) { } where xxx is defined to be literal false makes the code in the body never included in the binary (this helps me a lot with eliminating all but essential code from builds for low-memory devices). Combined with (custom) annotations, this quite often makes it quite on par feature-wise with a preprocessor.

Children