53 lines
546 B
C++
53 lines
546 B
C++
|
|
#include <iostream>
|
|
|
|
void f ( int& i )
|
|
{
|
|
std::cout << "int" << std::endl;
|
|
}
|
|
|
|
void f ( const int& i )
|
|
{
|
|
std::cout << "const int" << std::endl;
|
|
}
|
|
|
|
#if 0
|
|
void f ( volatile int& i )
|
|
{
|
|
std::cout << "volatile int" << std::endl;
|
|
}
|
|
|
|
void f ( const volatile int& i )
|
|
{
|
|
std::cout << "const volatile int" << std::endl;
|
|
}
|
|
#endif
|
|
|
|
int g ( )
|
|
{
|
|
int i = 2;
|
|
return i;
|
|
}
|
|
|
|
int main( void )
|
|
{
|
|
#if 0
|
|
const volatile int cvi = 1;
|
|
f( cvi );
|
|
|
|
volatile int vi = 1;
|
|
f( vi );
|
|
#endif
|
|
|
|
const int ci = 1;
|
|
f( ci );
|
|
|
|
int i = 1;
|
|
f( i );
|
|
|
|
f( g() );
|
|
|
|
return 0;
|
|
}
|
|
|