Recent

Author Topic: is there a variable number macro arguments ?  (Read 3457 times)

whatsup

  • Jr. Member
  • **
  • Posts: 59
is there a variable number macro arguments ?
« on: March 05, 2017, 04:56:45 pm »
hey all
is there a macro with variable number of arguments like in C/C++ ?

C syntax:
 #define MyMacro1(...)
  #define MyMacros2(x,...)


it's possible to call these macros with any number of arguments

is something like this avaible in freePascal ?

thanks in advanced

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: is there a variable number macro arguments ?
« Reply #1 on: March 05, 2017, 05:00:03 pm »

Thaddy

  • Hero Member
  • *****
  • Posts: 14359
  • Sensorship about opinions does not belong here.
Re: is there a variable number macro arguments ?
« Reply #2 on: March 05, 2017, 05:08:00 pm »
No.
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11445
  • FPC developer.
Re: is there a variable number macro arguments ?
« Reply #3 on: March 05, 2017, 05:11:11 pm »
FPC does not support parameterised macros, so also not with multiple parameters.

But if you want to use Pascal only, most cases can be solved with inline functions and/or array of const.

Or use an external preprocessor before compiling your sources, even C's.

 

TinyPortal © 2005-2018