praise: optional comma at the end of argument list is a life saver for generated code

mw mingwu at gmail.com
Sun Sep 13 18:57:14 UTC 2020


I'm referring to this:

https://github.com/mingwugmail/talibd/blob/master/source/talibd.d#L109

  int lookback = 
TA_MACD_Lookback(optInFastPeriod,optInSlowPeriod,optInSignalPeriod,);


D compiler accept (but ignore) the last comma "," is a life saver 
for generated code.

Otherwise, one have to find new ways to remove it which is a 
nuisance.


(The generating C macro in this case, are defined as:

#define SPLIT_THEN_TAKE_VAR(X)     SPLIT(TAKE_VAR,   X),

   int lookback = TA_FUNC##_Lookback(FOR_EACH(SPLIT_THEN_TAKE_VAR, 
FUNC_INS)); __NL__\

https://github.com/mingwugmail/talibd/blob/master/source/talibd.h#L121
https://github.com/mingwugmail/talibd/blob/master/source/talibd.h#L60
)




More information about the Digitalmars-d mailing list