| | |
for loop as a macros
![]() |
•
•
Join Date: Aug 2008
Posts: 206
Reputation:
Solved Threads: 31
Firstly, there is no space between the closing bracket at the end of FOR(x,n) and preceding the rest. That's a stylistic concern, but badly hurts readability.
Second, and more significantly, typeof() is not a standard function or operator in C++. It is an extension specific to g++ (GNU c++) in which typeof(x) expands to be type of x and will trigger a compiler error with every compiler that does not support that extension. Within a for loop (assuming you're using g++), if x is an int, then
Second, and more significantly, typeof() is not a standard function or operator in C++. It is an extension specific to g++ (GNU c++) in which typeof(x) expands to be type of x and will trigger a compiler error with every compiler that does not support that extension. Within a for loop (assuming you're using g++), if x is an int, then
FOR(x,n) would expand to for (int; x < n; x++) which is invalid code. Apart from anything else this useless macros must be
c++ Syntax (Toggle Plain Text)
#define FOR(x,n)for(typeof(x)x=0;x<(n);x++)
![]() |
Similar Threads
- Starting Python (Python)
- Safe Array (C++)
- Excel macros with asp.net (ASP.NET)
- need help.. VBA in access and excel.. (Visual Basic 4 / 5 / 6)
- Tricky Questions (C)
- substitute of semicolon (C++)
- vc++ mfc-i can't make getline work with a string for file input (C++)
- can someone please explain??????? (C)
- Need help with recursion and arrays (C++)
- Sorting a selection (Visual Basic 4 / 5 / 6)
Other Threads in the C++ Forum
- Previous Thread: Quick question
- Next Thread: Help with manually creating a BMP image
| Thread Tools | Search this Thread |
ace_thread api array based binary bitmap borland c++ c/c++ calling char class classes code coding compile console conversion count delete delete-line deploy desktop developer directshow dll download dynamic dynamiccharacterarray email embedded encryption error file forms fstream function functions game givemetehcodez graph gui homeworkhelp homeworkhelper iamthwee ifstream information input int integer java lib linkedlist linker loop looping loops map math mathhomeworkhelp matrix memory multiple news node number numbertoword output parameter pointer problem program programming project python random read recursion reference reverse richedit rpg string strings temperature template test text text-file tree url variable vector video win32 windows winsock word wordfrequency wxwidgets






