Re: Nim source equivalent to C #define

2018-09-26 Thread geezer9
Many thanks for all the suggestions. Since NEEDEDFLAG can also be set by: nim c -d:NEEDEDFLAG etc.etc. Run I need to use defined(NEEDEDFLAG) instead of declared(NEEDEDFLAG). However the following inside nim.cfg worked for me: @if BGMAP: define:

Re: Nim source equivalent to C #define

2018-09-26 Thread Hlaaftana
One that hasn't been mentioned yet is simply: const NeededFlag = defined(DependentFlag) when NeededFlag: discard # code goes here Run

Re: Nim source equivalent to C #define

2018-09-26 Thread jangko
Actually Nim has {.define: identifier.} pragma, but then it was deprecated. I'm curious to know what was the reason. Doesn't it behave similarly with '-d:' or '\--define:'?

Re: Nim source equivalent to C #define

2018-09-26 Thread mratsim
I use a [nim.cfg in Arraymancer](https://github.com/mratsim/Arraymancer/blob/7edf23662328c059cd22be4cd08c00556321e4d1/nim.cfg#L43): @if cudnn: define:"cuda" @end Run

Re: Nim source equivalent to C #define

2018-09-26 Thread lotzz
i just want to say, i love how many good options nim has for such a simple thing. Nim -- a buffet for the programmers taste

Re: Nim source equivalent to C #define

2018-09-26 Thread juancarlospaco
{. emit: """#define SOMEOPTION""" .} Run Literal, For C target.

Nim source equivalent to C #define

2018-09-26 Thread geezer9
Is there a pragma (or some such) that performs like the C preprocessor command: #define SOMEOPTION Run I would like definition of some debugging flags to automatically define others. For example: when defined(DEPENDENTFLAG): {.define(NEEDEDFLAG

Re: Nim source equivalent to C #define

2018-09-26 Thread lotzz
const Thing = 0 when declared(Thing): const otherThing = 0 when declared(otherThing): echo "we are here" Run this works