Skip to content

Instantly share code, notes, and snippets.

Joonmo Yang Bloofer

Block or report user

Report or block Bloofer

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View arraytest.java
import java.util.Arrays;
public class ArraysCopy{
public static void main(String args[]){
int[] A = {1,2,3,4,5,6,7,8,9,10};
int[][] B = {
{0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0}
View buffer_overrun2.cpp
#include <string.h>
#include <stdio.h>
void foo (char *bar)
{
float My_Float = 10.5; // Addr = 0x0023FF4C
char c[28]; // Addr = 0x0023FF30
// Will print 10.500000
printf("My Float value = %f\n", My_Float);
View buffer_overrun1.cpp
#include <string.h>
void foo (char *bar)
{
char c[12];
strcpy(c, bar); // no bounds checking
}
int main (int argc, char **argv)
View Type System Rejects
if (p) x = 5;
else x = "hello";
if (p) return x+5;
else return strlen(x);
@Bloofer
Bloofer / constexpr.cpp
Created Feb 27, 2019
constexpr example
View constexpr.cpp
constexpr double power( double x, unsigned int y )
{
return y == 1 ? x : x * power( x, y - 1 ) ;
}
int main()
{
// 정수 식
constexpr double a = power( 2, 32 ) ;
View volatile3.cpp
static volatile int foo;
void bar (void)
{
foo = 0;
while (foo != 255);
}
@Bloofer
Bloofer / volatile2.cpp
Created Feb 27, 2019
after optimization
View volatile2.cpp
void bar_optimized(void)
{
foo = 0;
while (true);
}
@Bloofer
Bloofer / volatile1.cpp
Created Feb 27, 2019
before optimization
View volatile1.cpp
static int foo;
void bar(void)
{
foo = 0;
while (foo != 255);
}
@Bloofer
Bloofer / const.cpp
Created Dec 24, 2018
const example
View const.cpp
// Bad Idea
class MyClass
{
public:
MyClass(std::string t_value)
: m_value(t_value)
{
}
std::string get_value()
@Bloofer
Bloofer / increment.cpp
Created Dec 24, 2018
increment example
View increment.cpp
// Bad Idea
for (int i = 0; i < 15; i++)
{
std::cout << i << std::endl;
}
// Good Idea
for (int i = 0; i < 15; ++i)
{
You can’t perform that action at this time.