* * *

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

whatsup

  • New member
  • *
  • Posts: 45
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: 2324
Re: is there a variable number macro arguments ?
« Reply #1 on: March 05, 2017, 05:00:03 pm »

Thaddy

  • Hero Member
  • *****
  • Posts: 4807
Re: is there a variable number macro arguments ?
« Reply #2 on: March 05, 2017, 05:08:00 pm »
No.
"Logically, no number of positive outcomes at the level of experimental testing can confirm a scientific theory, but a single counterexample is logically decisive."

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5875
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.

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus