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
union swap_byte { | |
void swap(); | |
void set_byte(unsigned short i); | |
void show_word(); | |
unsigned short u; | |
unsigned char c[2]; | |
}; |
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> | |
class A { | |
public: | |
virtual int foo(int *num) { | |
const int height = 150; //in cm | |
int sum = height + *num; | |
std::cout << sum << std::endl; | |
return sum; | |
}; |
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
class ListNode { | |
friend class List; | |
public: | |
ListNode* nextNodePointer; | |
ListNode* previousNodePointer; | |
int value; | |
private: | |
/** | |
* Constructs an empty element of the list, points to NULL by default |
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
template <typename T> | |
VectorIterator<T>& VectorIterator<T>::operator=(VectorIterator<T>& iter) { | |
elemPointer = iter.elemPointer; | |
return *this; | |
} |
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
// class derived_class; | |
class main_class { | |
public: | |
derived_class foo(); // error: ‘derived_class’ does not name a type | |
}; | |
derived_class main_class::foo() {} // error: ‘derived_class’ does not name a type | |
template <typename T> |
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
static inline void setTimerSettingsToDefaultByNum(uint_fast8_t timerNum) { | |
// enable timer interrupt | |
CpuTimer0Regs.TCR.bit.TIE = 1; | |
// free run mode switch on | |
CpuTimer0Regs.TCR.bit.FREE = 1; | |
CpuTimer0Regs.TCR.bit.SOFT = 0; | |
// set preload value and timer prescaler | |
CpuTimer0Regs.PRD.all = 0xFFFF; | |
CpuTimer1Regs.TPR.bit.TDDR = 0xFF; |
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
static const u08 BTN_NOT_PRESSED = 1; | |
int main() { | |
static u08 previousBtnState[4] = {BTN_NOT_PRESSED, | |
BTN_NOT_PRESSED, | |
BTN_NOT_PRESSED, | |
BTN_NOT_PRESSED}; | |
} | |
/* |
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
cmake_minimum_required(VERSION 2.8) | |
include(ExternalProject) | |
project(freetype_test) | |
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall") | |
set(LIBS_DIR ${PROJECT_SOURCE_DIR}/libs) | |
set(FREETYPE_VER "2.5.3") | |
set(SDL2_VER "2.0.3") |
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
libtool: link: gcc -I/home/snikitin/_src/img_glypher/libs/SDL2/src/sdl2_project/include -I/usr/local/include/SDL2 -D_REENTRANT -o showimage showimage.o -Wl,-rpath -Wl,/usr/local/lib -pthread -L/home/snikitin/_src/img_glypher/libs/SDL2/src/sdl2_project-build ./.libs/libSDL2_image.a -L/usr/local/lib -lSDL2 -pthread | |
/home/snikitin/_src/img_glypher/libs/SDL2/src/sdl2_project-build/libSDL2.a(SDL_dynapi.c.o): In function `get_sdlapi_entry': | |
/home/snikitin/_src/img_glypher/libs/SDL2/src/sdl2_project/src/dynapi/SDL_dynapi.c:227: undefined reference to `dlopen' | |
/home/snikitin/_src/img_glypher/libs/SDL2/src/sdl2_project/src/dynapi/SDL_dynapi.c:228: undefined reference to `dlsym' | |
/home/snikitin/_src/img_glypher/libs/SDL2/src/sdl2_project/src/dynapi/SDL_dynapi.c:227: undefined reference to `dlopen' | |
/home/snikitin/_src/img_glypher/libs/SDL2/src/sdl2_project/src/dynapi/SDL_dynapi.c:228: undefined reference to `dlsym' | |
/home/snikitin/_src/img_glypher/libs/SDL2/src/sdl2_project/src/dynapi/SDL_dynapi.c:227: undefined referenc |
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
/** | |
* @brief Converts std::unique_ptr of base type to std::unique_ptr of derived type | |
* by using static_cast internally | |
* @details Ownership of the object is transfered to the returned std::unique_ptr. | |
* It is somewhat analogous to std::static_ptr_cast | |
*/ | |
template<typename Derived, typename Base, typename Deleter> | |
std::unique_ptr<Derived, Deleter> static_ptr_cast(std::unique_ptr<Base, Deleter> base) | |
{ | |
auto deleter = base.get_deleter(); |
OlderNewer