471,122 Members | 1,147 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,122 software developers and data experts.

"FOR" in preprocessor macro

would it be possible to sort of engineer some sort of preprocessor macro
that does a 'for' loop.
i.e. for where you would normally use a normal for loop, but when it is
known ay compile time whay the variable is, hence unrolling the loop.
Nov 17 '05 #1
3 1740
songie D wrote:
would it be possible to sort of engineer some sort of preprocessor
macro that does a 'for' loop.
i.e. for where you would normally use a normal for loop, but when it
is known ay compile time whay the variable is, hence unrolling the
loop.


http://www.boost.org/libs/preprocessor/doc/index.html

-cd
Nov 17 '05 #2
Carl Daniel [VC++ MVP] wrote:
songie D wrote:
would it be possible to sort of engineer some sort of preprocessor
macro that does a 'for' loop.
i.e. for where you would normally use a normal for loop, but when it
is known ay compile time whay the variable is, hence unrolling the
loop.


http://www.boost.org/libs/preprocessor/doc/index.html


Doesn't VC already do this with a normal for-loop when optimising for speed,
the number of iterations can be determined at compile time, and the amount
of inserted code is reasonable small?

I'm certain I've come across a compiler that did that, but I can't remember
for certain if VC does it though...

--
Sven Groot

http://unforgiven.bloghorn.com

Nov 17 '05 #3
Sven Groot wrote:
Carl Daniel [VC++ MVP] wrote:
songie D wrote:
would it be possible to sort of engineer some sort of preprocessor
macro that does a 'for' loop.
i.e. for where you would normally use a normal for loop, but when it
is known ay compile time whay the variable is, hence unrolling the
loop.


http://www.boost.org/libs/preprocessor/doc/index.html


Doesn't VC already do this with a normal for-loop when optimising for
speed, the number of iterations can be determined at compile time,
and the amount of inserted code is reasonable small?

I'm certain I've come across a compiler that did that, but I can't
remember for certain if VC does it though...


I'm not sure if VC does automatic loop unrolling, but there definitely are
compilers that do so.

-cd
Nov 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

11 posts views Thread by Ux | last post: by
9 posts views Thread by /* frank */ | last post: by
32 posts views Thread by Toby Newman | last post: by
12 posts views Thread by Robbie Hatley | last post: by
13 posts views Thread by bobby | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.