Program Preprocessor variable postfix , C/C++ Programming

Run the following C++ program with and without preprocessor variable POSTFIX defined.

#include

using namespace std;

extern "C" int atoi( const char *str );

struct Node {

int i, j, k;

Node() {}

};

int main( int argc, char *argv[ ] ) {

int times = 10000;

switch ( argc ) {

case 2:

times = atoi( argv[1] );

} // switch

vector v( 10000 );

vector::iterator vi;

volatile int j = 0; // ignore, prevent loop elimination

for ( int i = 0; i < times; i += 1 ) {

for ( vi = v.begin(); vi != v.end();

#ifdef POSTFIX

vi ++

#else

++ vi

#endif

) {

j += 1; // ignore, prevent loop elimination

}

}

}

Posted Date: 3/2/2013 2:13:54 AM | Location : United States







Related Discussions:- Program Preprocessor variable postfix , Assignment Help, Ask Question on Program Preprocessor variable postfix , Get Answer, Expert's Help, Program Preprocessor variable postfix Discussions

Write discussion on Program Preprocessor variable postfix
Your posts are moderated
Related Questions
depth description of the inside and outside typecasting

convert BST into sorted doubly linked list

(a) Write a procedure that computes the Ackermann-Peter a(m,n) function. (b) Write a helper procedure that only allows the calculation of the Ackermann-Peter function for 0≤m


Ask question #Minimum 100Problem : Compiler Design - Limit the methods Rahul is a newbie to the programming and while learning the programming language he came to know the followi

Exceptions. Your SVector class should throw four exceptions: 3.1. If the constructor size is invalid, then it will just allow the implicit STL bad_alloc exception to pass up to mai

Solve the Nine Queens problem recursively. The objective is to place nine queens on an empty chessboard so that no queen is “attacking” any other, i.e., no two queens are in the sa

program that decodes sending smuggler''s string

Hi, I need quick sort program without using recursion

Create a pseudocode in getting Calendar Quarter. The program should identify which quarter falls the given date. Note: Consider the date format DDMMYYYY.