This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Loop unrolling


> > Branko Cibej <branko.cibej@hermes.si>,
> 
> His example was mistaken.  He had no ``empty'' loops.
> 
>                 for (size_t i = 0; i < size; ++i)
>                     new (&objs[i]) T(init);
> 
> In this case, ``new (&objs[i]) T(init)'' != ``'', hence the loop is
> not empty.
> 
>     for (size_t i = 0; i < size; ++i)
>                     objs[i].~T();
> 
> In this case, ``objs[i].~T()'' != ``'', hence the loop is not empty.

Well, how about some plain C macroid code:

#define NOP(X, N) /* This space intentionally left blank */

#define FROB(X, OP) \
do { \
  foo (x); \
  for (i = n; --i >=0; ) \
    OP (X, i); \
  bar(x); \
} while (0);

FROB (x, NOP);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]