Author Topic: #defines and D language  (Read 8381 times)

Offline afb

  • Developer
  • Lives here!
  • *****
  • Posts: 884
#defines and D language
« on: March 29, 2007, 09:11:34 am »
Seems like the compiler options dialog doesn't work well when setting "" as the #define flag...

Since there are no #defines in the D language (only in C/C++), there is no proper value for the flag. I set it to a bogus value and it "works", but not sure if that's the best workaround ? But before we have support for multiple programming languages, it might do. (at least it closes the bug reported with the compiler interface...)

http://www.algonet.se/~afb/wx/codeblocks-svn-dmddefines.patch

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: #defines and D language
« Reply #1 on: March 29, 2007, 02:41:13 pm »
Your patch seems to do the trick. If you tested it and it works too, then just commit it.
Better support for other languages/compilers will come after version 1.0 is released.

I would just use a more descriptive name for the switch instead of "\a". Something like "NoDefinesAllowed" :).
Be patient!
This bug will be fixed soon...

Offline afb

  • Developer
  • Lives here!
  • *****
  • Posts: 884
Re: #defines and D language
« Reply #2 on: March 30, 2007, 10:42:01 am »
OK, that's a better name... :-)

But I thought of something else, D doesn't have #defines but it does have "versions". So instead of just making that area unusable, we might rename the field for defines into versions when setting it for a D compiler. Then it's just a matter of using the -version or -fversion compiler switches...

So where for C/C++ you would set "__WXMAC__" and it would pass -D__WXMAC__ to the compiler, in D you would set "__WXMAC__" and it would pass -version=__WXMAC__ to it.

This define/version is then used by the conditionally compiled code like:
Code: c++
#ifdef __WXMAC__
    ....
#endif

Code: d
version (__WXMAC__)
{
    ....
}

http://www.algonet.se/~afb/wx/codeblocks-svn-dmdversions.patch
« Last Edit: March 30, 2007, 02:33:51 pm by afb »