473,750 Members | 2,648 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

"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 1880
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
1746
by: Ux | last post by:
Hi I'm a newbie at JS and I'd like to know, from the expert JS-er, which are the "things" they consider a *must have* (or known/visited/read...) for a professional JS developer. This will help me and others newbie to start with the right foot and to catch the propers tools. Thanx to all Marco
8
10646
by: Lian | last post by:
Hi all, It is a newbie's question about html tag "img". The attributes "title" and "alt" for "img" seems having the same function. So what is the main difference between them? Can i use them at the same time and set different values? Thank you for suggestions!
9
1965
by: /* frank */ | last post by:
I want system ("CLS") if the system is WINDOWS system ("CLEAR") is the OS is a UNIX like.
32
4654
by: Toby Newman | last post by:
At the page: http://www.strath.ac.uk/IT/Docs/Ccourse/subsection3_8_3.html#SECTION0008300000000000000 or http://tinyurl.com/4ptzs the author warns: "The for loop is frequently used, usually where the loop will be traversed a fixed number of times. It is very flexible, and novice programmers should take care not to abuse the power it offers."
12
2109
by: Robbie Hatley | last post by:
I'm getting a bizarre error with this code: ... case WM_COMMAND: { switch (LOWORD(wParam)) // switch (control ID) { ... case IDC_RAIN_ENABLE_SIMPLE: {
2
2073
by: marsarden | last post by:
write code like: int main(void) { int a=10; if(a<20) {} } Compiler ok on dev-cpp . don't we have to add a ";" after if
8
2330
by: kaili | last post by:
i'm chinese i heard that "The C Programming Language " by Brian W. Kernighan, Dennis Ritchie is the best book for new learners. but it is unavailable here. i mearn there is nobody selled it. i wonder any body can help me???
13
10672
by: bobby | last post by:
hello group, what does for( ; ; ) mean in C program Thanks
1
1177
by: Warren Tang | last post by:
Hi I have to attach to the aspnet_wp.exe frequently. Is there any shortcut or macro for it? Regards Warren
0
8838
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9342
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9256
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6808
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6081
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4716
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4888
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3323
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2807
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.