Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.std.c > #6423

Re: conditional macro definition also for recursive conditionally limited expansion

From Tim Rentsch <tr.17687@z991.linuxsc.com>
Newsgroups comp.std.c
Subject Re: conditional macro definition also for recursive conditionally limited expansion
Date 2022-01-17 07:51 -0800
Organization A noiseless patient Spider
Message-ID <86v8yis6mt.fsf@linuxsc.com> (permalink)
References <723aa6f8-0994-4b1d-b2d2-59abe33906ban@googlegroups.com>

Show all headers | View raw


Marco Munari <allerta.it@gmail.com> writes:

> I thought it could be nice to introduce condition inside macro
> definition, to produce less jumping code (so compiler can output
> bigger but more efficient code with concise definition)
>
> a syntax could be defined by adding an optional #defif (due to the
> late time this could be introduced to C, that would be my preference
> reminding to who would learn by seeing it that the if is part of the
> macro definition) as
> #define macro(#N,x) #defif (#N>0) macro(#N-1,?) #defelse ?
>
> usable with macro(5,x)
> expansion parameter that i called #N need to be a constant provided
> to the expansion engine, the # prefix I indicated here is not a
> syntax necessity because it can be deduced by the fact that this
> parameters appears in the #defif condition which also must be fully
> valuable during preprocessing (just a bit more powerful
> preprocessing)  [...]

It's an interesting idea.  There are details that need to be
explored and understood first.  Also I think it would be better
if expanded and generalized, perhaps along the lines of 'cond'
in lisp, or alternatively with ?# :# as preprocessing if/else.
Hmmm...

Back to comp.std.c | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

conditional macro definition also for recursive conditionally limited expansion Marco Munari <allerta.it@gmail.com> - 2022-01-09 16:52 -0800
  Re: conditional macro definition also for recursive conditionally limited expansion James Kuyper <jameskuyper@alumni.caltech.edu> - 2022-01-10 00:48 -0500
    Re: conditional macro definition also for recursive conditionally limited expansion Tim Rentsch <tr.17687@z991.linuxsc.com> - 2022-01-17 07:13 -0800
  Re: conditional macro definition also for recursive conditionally limited expansion Tim Rentsch <tr.17687@z991.linuxsc.com> - 2022-01-17 07:51 -0800
    Re: conditional macro definition also for recursive conditionally limited expansion Marco Munari <allerta.it@gmail.com> - 2022-01-18 04:24 -0800
      Re: conditional macro definition also for recursive conditionally limited expansion Tim Rentsch <tr.17687@z991.linuxsc.com> - 2022-01-19 06:53 -0800

csiph-web