static void nonblock();

하하의 이미지

static void set_nonblock(int sock) {
:
:
}

이런 함수가 있습니다.

이때 static 이란 키워드(속성)는 무엇을 수식하는 건가요?

void 아님 set_nonblock 인가요?

함수의 return 형이 상수형이다 따라서 변경되어선 안된다??

아님 set_nonblock 함수를 가리키는 포인터는 static영역에

위치하고 그값은 변경되지 않는다...

이럴경우는 자주 사용되어지는 함수는 이와 같은 속성을 앞에

넣어준다.? ... 제 생각이 맞나요?? 여러분의 의견을 듣고 싶습니다.

그럼 즐거운 하루되세요.....

맹고이의 이미지

전역변수 static int foobar; 처럼

그 파일내에서만 사용한다... 는 의미가 아닐런지요.

하하의 이미지

아 좀 착각 했습니다.

const 와 static 키워드를 혼동했습니다.

위 글중 상수란 말은 빼고 생각해 주세요.

static은 scope로 영역을 나타내는데..

그렇담.. 위 함수는 해당 파일에서만

참조 가능하다라고 생각하면 되겠네요...

“바람에게도 길은 있다. 나는 비로소 나의 길을 가느니. 길은 언제나 어디에나 있다.”

전웅의 이미지

하하 wrote:
아 좀 착각 했습니다.

const 와 static 키워드를 혼동했습니다.

위 글중 상수란 말은 빼고 생각해 주세요.

static은 scope로 영역을 나타내는데..

그렇담.. 위 함수는 해당 파일에서만

참조 가능하다라고 생각하면 되겠네요...

static 의 의미는 중의적입니다. 문맥에 따라 다른 의미를 갖는 keyword
입니다.

--
Jun, Woong (woong at gmail.com)
http://www.woong.org

하하의 이미지

Quote:

static 의 의미는 중의적입니다. 문맥에 따라 다른 의미를 갖는 keyword
입니다.

예를 들어 설명해 주시면 감사하겠습니다. ^__^;;

“바람에게도 길은 있다. 나는 비로소 나의 길을 가느니. 길은 언제나 어디에나 있다.”

pynoos의 이미지

중의적이라고 한다면 static이 variable과 function 에 따라 의미가 완전히 다른 것(사실은 비슷한)인데, 같은 keyword를 사용한다는 말 같군요.

variable에 사용될 때는 전역변수에 대하여 참조할 수 있는 범위를 file scope로 제한, 지역변수에 대하여 함수나 괄호안으로 scope 제한, life cycle 이 process 소멸시기와 같은 것과 같이 걸리는 곳이 많지만,
function 에 사용될 때는 호출가능한 범위를 file scope로 두는 의미가 있고, life cycle에는 의미가 없습니다.

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.