[[ blog 이사 과정에서 정확한 posting날짜가 분실됨. 년도와 분기 정도는 맞지 않을까? ]]
 

아래의 항목은 "죠엘"의 블로그에 소개되어이 있는 내요들이다. 뭐 100% 동의하는 것은 아니지만, 충분히 기억해 둘 만하다.

1. 소스코드 관리시스템을 사용하고 있는가?
2. 한 번에 빌드 결과물을 만들어낼 수 있는 script를 사용하고 있는가?
3. 일일 빌드를 하고 있는가?
4. 버그 추적시스템을 운영하고 있는가?
5. 코드를 새로 작성하기 전, 매 baseline마다 알려진 모든 버그를 수정하는가?
6. 일정을 업데이트 하는가?
7. 요구명세서, 설계명세서 등 명세서를 작성하는가?
8. 개발자에게 조용하고 개인적인 작업환경을 제공하는가?
9. 경제적인 범위 내에서 최고의 성능의 도구를 사용하는가?
10. 테스터를 별도로 두고 있는가?
11. 프로그래머 채용 인터뷰 때 코딩 테스트를 하는가?
12. 무작위 사용편의성 테스트를 수행하는가?

[[ blog 이사 과정에서 정확한 posting날짜가 분실됨. 년도와 분기 정도는 맞지 않을까? ]]

XOR and minus seems to be about the same in concept, because, as if "A-B" means "difference between A and B", A^B also means "bitwise difference between A and B".

Let's see following two SWAP algorithm. (Analysing following alogrithm will be helpful to understand difference of concept between 'A-B' and 'A^B').

add swap
*x = *x + *y;
*y = *x - *y;
*x = *x - *y;

xor swap
*x ^= *y;
*y ^= *x;
*x ^= *y;

We should focus on that both of '-' and XOR are operation to get "difference".
('-' is difference of number and XOR is bitwise difference. But, those are all "difference"!)
So, we can implement swap operation with both '-' and "XOR".

Here is conceptual description of XOR swap.
*x ^= *y; "Store difference of 'original x' and 'original y'"
*y ^= *x; "We know difference of 'original x' and 'original y'(x). So, we can get 'original x' with 'original y' and store it into 'y'."
*x ^= *y; "We know difference of 'original x' and 'original y'(x), and 'orignal x'(y). So, we can get 'original y' and store it into 'x'."

Understanding something is "Understanding it's basic concept". It's very important.!!

So, someone who understands XOR, should be able to infer "swap with XOR" at the moment of knowing about "swap with '+/-'"

'Study > Computer Science' 카테고리의 다른 글

[Study] Ascending Stack Vs. Descending Stack  (0) 2007.02.07
[Study] Full Stack Vs. Empty Stack  (0) 2007.01.08
[[ blog 이사 과정에서 정확한 posting날짜가 분실됨. 년도와 분기 정도는 맞지 않을까? ]]

There is copy construction in C++. And default copy constructor does shallow copy. But, we should take care of shallow-copied-instance. Every programmer knows about this issue. But, sometimes, it is difficult to detect mistake from shallow copy. Here is an example.

// a.h
class A
{
public:
    A(void){
        _ptr = NULL; _len = 0;
    }

    A(int len){
        _len = len;
        _ptr = malloc(_len);
    }

    ~A(void){
        if(NULL != _ptr) { free(_ptr); }
    }

    void*  _ptr
    int _len
};

-------

// file1.c
static A gA(100); // --- (*a)
void getA (A& param)
{
    A = gA;
}

// file2.c
void function (void)
{
    A localA; // --- (*1)
    getA(localA);
    ...
    // do something with localA.
    ...
}

In this case, 'localA'(*1)'s destructor is called at the moment of returning from the function. And at that time, memory of 'gA._ptr' is freed, because 'localA' is shallow copy of 'gA'.
Stack variable is automatically(implicitly) destructed when function is returned. And this is not easy to realize without keeping it in mind.

+ Recent posts