View Single Post
Old 01-06-2012, 06:39 AM   #7
master of fugue
cohadar's Avatar
Join Date: Jun 2007
Posts: 2,453

Submissions (5)

cohadar is just really nice (250)cohadar is just really nice (250)cohadar is just really nice (250)cohadar is just really nice (250)cohadar is just really nice (250)


Originally Posted by 0zyx0
I would find #define to be useful, but not the others. Perhaps also #foreach, to replace short loops with something more efficient. But the other features seem (to me) either useless, or uglier alternatives to what exists.

Most parts of macro preprocessor have already been implemented by vexorian,
the problem is they do not all look like preprocessor constructs.
  • //! include
  • //! external
  • //! textmacro
  • optional
  • static if
  • module

The last three clearly do not look like preprocessing statements but rather like jass extensions.
This kind of programming stile is misleading.

As for comments on the estetics of this stuff vs C preprocessor directives,
I think that should have to wait for someone to make proper color coding for #statements.

Originally Posted by Troll-Brain
Anyway, unless a space " " is a valid first character for a #define i fail to see how to define RemoveUnit, without breaking other functions such as GroupRemoveUnit.
Or maybe defines will work as intented without the need of a space, i can't test it now.
It takes some time for people to learn how to use C preprocessing properly.
Here is a tip for your particular problem:
Make a macro for GroupRemoveUnit before you make a macro for RemoveUnit.

Originally Posted by Troll-Brain
I can't even use the tool in command line before jasshelper to remove comments, since it will also remove all external commands (//!...)
You got that the wrong way.
Removing comments has been disabled so preprocessor would not destroy old external commands and textmacros. Compatibility ftw.

Originally Posted by Troll-Brain
Also, i have not tried yet but i'm stll wondering if strings "..." are affected by the defines.
Yes they are.
There is an option to turn it off but I see no reason for it.

Originally Posted by Troll-Brain
And also not tested, but i suppose you handle requirements (library A requires B, scopes, ...) before doing any defines, else that wouldn't work that much.
No, C preprocessing happens before EVERYTHING else.
That way you can do things like this:
Collapse JASS:
ifdef PUI
library mylib uses PUI
elif Autoindex
library mylib uses Autoindex
  error "mylib needs at least one indexing system"
Of course optional keyword does the same in one line,
but than again it does not error if you have both libraries at the same time
or if you don't have either.

Originally Posted by Troll-Brain
Anyway thx for this and jasshelper, i had almost no interest in wc3 modding but you gave me some.
Omg database crash deleted my signature, as a side effect this immensely improved wc3c.
cohadar is offline   Reply With Quote