This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void test() | |
| { | |
| int a = 0x00002; | |
| char p = ((char*)(&a))[0]; | |
| cout << (int)p << endl; | |
| } | |
| int main() | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| C++ static 变量初始化时间就和普通static的初始化时间是一样的。 | |
| */ | |
| #include <iostream> | |
| using namespace std; | |
| class A | |
| { | |
| public: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * test_cpp.cc | |
| * | |
| * Created on: May 29, 2014 | |
| * Author: damonhao | |
| */ | |
| #include <iostream> | |
| #include <string> | |
| using namespace std; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class A { | |
| public int n=1; | |
| public static void main(String[] args) { | |
| A obj1=new A(); | |
| A obj2=new A(); | |
| A obj3=obj1; | |
| String s1=new String("abc"); | |
| String s2=new String("abc"); | |
| String s3="abc"; | |
| System.out.println(obj1==obj2); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * test_bind.cc | |
| * | |
| * Created on: Aug 10, 2014 | |
| * Author: damonhao | |
| */ | |
| #include <boost/shared_ptr.hpp> | |
| #include <boost/bind.hpp> | |
| #include <boost/function.hpp> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <sstream> | |
| #include <iostream> | |
| int main() | |
| { | |
| std::string s("0xFFF000"); | |
| unsigned long value; | |
| std::istringstream iss(s); | |
| iss >> std::hex >> value; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| using namespace std; | |
| struct A | |
| { | |
| int a; | |
| int b; | |
| int c; | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #define __STDC_FORMAT_MACROS | |
| #include <inttypes.h> | |
| #include <stdio.h> | |
| int main() | |
| { | |
| uint64_t ui64 = 90; | |
| printf("test uint64_t : %" PRIu64 "\n", ui64); | |
| return 0; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "s1.h" | |
| #include "s2.h" | |
| #include "s3.h" | |
| /* | |
| If s3.h comes before s2.h, B::g will call A::f(int). | |
| Else if sl.h comes before s2.h, B::g will call A::f(double). | |
| Else B::g won't compile at all. | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * test_io.cc | |
| * | |
| * Created on: Jun 4, 2014 | |
| * Author: damonhao | |
| */ | |
| #include <ev++.h> | |
| #include <stdio.h> |