[ create a new paste ] login | about

Link: http://codepad.org/KVv4KD8O    [ raw code | output | fork ]

C++, pasted on Apr 14:
#include <iostream>
 
void test1(void)
{
	int a = 1;
	std::cout << a << a++ << std::endl;
}
 
void test2(void)
{
	int a = 1;
	std::cout << a++ << a << std::endl;
}
 
void test3(void)
{
	int a = 1;
	std::cout << a++ << a++ << std::endl;
}
 
int main()
{
	test1();
	test2();
	test3();
	return 0;
}


Output:
1
2
3
4
5
6
7
cc1plus: warnings being treated as errors
In function 'void test1()':
Line 6: warning: operation on 'a' may be undefined
In function 'void test2()':
Line 12: warning: operation on 'a' may be undefined
In function 'void test3()':
Line 18: warning: operation on 'a' may be undefined


Create a new paste based on this one


Comments: