'PL'에 해당되는 글 7건

  1. 2009.04.11 선언이 안돼있어도 함수를 사용 by 언제나19
  2. 2008.10.28 Adobe AIR로 Hello World 프로그램 만들기 by 알 수 없는 사용자
  3. 2008.10.22 JavaScript and Object Oriented Programming (OOP) by 알 수 없는 사용자
  4. 2008.10.18 Overloading const and non-const by 알 수 없는 사용자
  5. 2008.10.11 O_RDONLY의 정의는 어느 헤더파일에? by 알 수 없는 사용자
  6. 2008.05.28 initializer element is not constant by 알 수 없는 사용자
  7. 2008.01.09 PHP에서 include 키워드 사용하기 by 알 수 없는 사용자

float를 return하는 함수를 만들어서 연이어 호출하고 있었는데,
어느 순간에선가 이상한 값을 return한다.
1.0을 return해야 하는데, 10564238429 이런 비슷한 값을..

어떤 값인지 한참을 해메다가
*(int*)&r
한 값이란 걸 알았다.
float 값을 int로 해석한 것.

원인은 header file에 signature를 실수로 안 적었기 때문.
signature를 안적어도 에러가 나지 않고 실행이 되고 있었다. 짜증나.
그러니까 default로 return 값을 int로 해석했던 것.

이와는 별개로
void*를 float로 변환하고 싶을 때,
void* voidpointer(void);
union u {
float f;
long l;
};
u.l = (long)voidpointer();
라고 적으면 u.f를 쓸 수 있다.
Posted by 언제나19
,

다음 링크를 참고하자.

http://filchiprogrammer.wordpress.com/2008/03/12/creating-a-sample-hello-world-adobe-air-application-with-html-and-javascript/

인증서 만드는 문제에 부딪혔다면, 인증서를 만들기 위해서 다음 링크를 참조하자.

http://www.elex.pe.kr/entry/Air-SDK%EB%A1%9C-Hello-World-%ED%94%84%EB%A1%9C%EA%B7%B8%EB%9E%A8%EC%9D%84-%EB%A7%8C%EB%93%A4%EA%B8%B0

AIR를 제대로 써보진 않았지만,

편한 패키징은 매우 매력적으로 다가왔다 :-)
Posted by 알 수 없는 사용자
,

JavaScript is an excellent language to write object oriented web applications. It can support OOP because it supports inheritance through prototyping as well as properties and methods. Many developers cast off JS as a suitable OOP language because they are so used to the class style of C# and Java. Many people don't realize that JavaScript supports inheritance. When you write object-oriented code it instantly gives you power; you can write code that can be re-used and that is encapsulated.

Reference:
http://www.javascriptkit.com/javatutors/oopjs.shtml
Posted by 알 수 없는 사용자
,

Posted by 알 수 없는 사용자
,

fcntl.h
Posted by 알 수 없는 사용자
,

Source:

#include <stdio.h>

struct camproc_string {
 int index;
 char *name;
};

struct camproc_string vga_effect_wb[] = {
    {
        .index  = 0,
        .name = "WB Auto",
    },
    {
        .index  = 1,
        .name   = "WB Sunny",
    },
    {
        .index  = 2,
        .name   = "WB Cloudy",
    },
    {
        .index  = 3,
        .name   = "WB Incandescent",
    },
    {
        .index  = 4,
        .name   = "WB Fluorescent",
    },
};

struct camproc_effect_named {
 int index;
 struct camproc_string *items;
};

static struct camproc_effect_named vga_effect_named[] = {
    {
        .index  = 0,
        .items = *vga_effect_wb,
    },
};

int main(int argc, char *argv[])
{
 printf("%s\n", vga_effect_named[0].items->name);
 
 return 0;
}


Compile:

[jmlim@hera jmlim]$ gcc -o kdsoo kdsoo.c
kdsoo.c:39: initializer element is not constant
kdsoo.c:39: (near initialization for `vga_effect_named[0].items')
kdsoo.c:41: initializer element is not constant
kdsoo.c:41: (near initialization for `vga_effect_named[0]')
[jmlim@hera jmlim]$


Analysis:
단순 포인터 오류.

Solution:
.items = *vga_effect_wb,를 .items = vga_effect_wb로 수정한다.

Compile & Run:

[jmlim@hera jmlim]$ gcc -o kdsoo kdsoo.c
[jmlim@hera jmlim]$ ./kdsoo
WB Auto
[jmlim@hera jmlim]$
Posted by 알 수 없는 사용자
,

PHP에서 include 키워드를 사용하면,

외부 파일을 현재 파일에 포함시킬 수 있다.

이 때, 외부 파일의 변수와 현재 파일의 변수 사이에 중복이 있는지 확인해야만 한다.

그렇지 않으면 캐삽질하는 수가..
Posted by 알 수 없는 사용자
,