This file contains 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
sizeof(Base)=16 | |
sizeof(Derived)=16 | |
0x7fffd1303400 | |
0x7fffd1303408 | |
vptr is at the beginning? true |
This file contains 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
package baiyanhuang; | |
import java.util.Arrays; | |
/** | |
* | |
* A utility class to help generate hash code: This is based on the theory from Effective Java, Item 9 | |
* | |
*/ | |
public class HashCodeGenerator { |
This file contains 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; | |
class Base | |
{ | |
public: | |
Base() {cout << "Base constructor called" << endl;} | |
}; |
This file contains 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
// we use double-lock check in singleton to solve the problem we met in spinlock1.cpp, but hey, that itself is a lock, it has to use some atomic intrusion/memory barrier to solve this synchronization problem | |
template<class T> | |
class SingletonHolder | |
{ | |
private: | |
static volatile T* instance; | |
static volatile int m_lockObj; | |
SingletonHolder() {} | |
This file contains 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 <stdio.h> | |
#include <stdlib.h> | |
#include <pthread.h> | |
#include<iostream> | |
using namespace std; | |
static pthread_mutex_t foo_mutex; | |
void* get_maokeng(void* param) | |
{ |
This file contains 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
<html> | |
<!-- http://d3js.org/ --> | |
<head> | |
<title> D3 Testing </title> | |
<script src="http://d3js.org/d3.v2.js"></script> | |
<style type="text/css"> | |
body { | |
background-color: green; | |
color: white; | |
} |
This file contains 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
#ifndef _LZ_UTILITY_COMMON_H | |
#define _LZ_UTILITY_COMMON_H | |
// Array size | |
template <typename T, size_t N> | |
char ( &_ArraySizeHelper( T (&array)[N] ) ) [N]; | |
#define ARRAY_SIZE(array) ( sizeof( _ArraySizeHelper(array) ) ) | |
#endif |
This file contains 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
echo Clear Mir Baiyan's coding arena!!! | |
cd .. | |
del /f /s /q *.obj | |
del /f /s /q *.pdb | |
del /f /s /q *.ilk | |
del /f /s /q *.pch | |
del /f /s /q *.ib_tag | |
del /f /s /q *.idb | |
del /f /s /q *.exe | |
del /f /s /q *.ncb |
This file contains 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 "linked_list.h" | |
#include "timer.h" | |
#include "LazyTest.h" | |
#include <list> | |
// standard | |
#include <ctime> | |
#include <random> | |
#include <algorithm> |
This file contains 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
#pragma once | |
#include <Windows.h> | |
#include <iostream> | |
// How to use: | |
// Example 1: | |
// double d1 = Tick(); | |
// double d2 = Tick(); | |
// double time = d2 - d1; | |
// |