ㅠㅠ;; 또 이해안가는 C문장..

BlackTiger의 이미지

struct XXX = {
    aaa : bbb,
    
    ...
};

위의 예를 보면 스트럭트 멤버정의를 하는데..
aaa : bbb, 이런 식으로 정의되어 있는데..무슨 뜻인지여..

예제에서는 aaa는 다른 struct의 멤버 함수이름이고
bbb는 로컬에 있는 함수 이름인데..
또 bbb가 함수 이름이 아니라 상수일 경우도 있더라구여..

흠..이거 GNU에만 있는 문법인가요? ㅜㅜ;;

bugiii의 이미지

비트 나타내는 거 아닌가요?

세벌의 이미지

bit field에 대해 공부해 보세요.
그 유명한 The C programming language 책에도 나옵니다.

young93의 이미지

BlackTiger wrote:
struct XXX = {
    aaa : bbb,
    
    ...
};

위의 예를 보면 스트럭트 멤버정의를 하는데..
aaa : bbb, 이런 식으로 정의되어 있는데..무슨 뜻인지여..

예제에서는 aaa는 다른 struct의 멤버 함수이름이고
bbb는 로컬에 있는 함수 이름인데..
또 bbb가 함수 이름이 아니라 상수일 경우도 있더라구여..

흠..이거 GNU에만 있는 문법인가요? ㅜㅜ;;

커널코드에 많이 나오는 표현이더군요.

aaa는 구조체 XXX의 멤버변수 이고, bbb는 aaa의 초기값입니다.
즉, 다음 처럼
XXX.aaa = bbb;
XXX.aaa를 bbb로 초기화하겠다는 의미입니다.

aaa 가 다른 구조체의 멤버라고 하셨는데,
다시 확인해 보시면 XXX의 멤버일겁니다.
bbb가 함수이름인 경우는 XXX.aaa 가 함수포인터이기 때문이겠죠.

표준인지는 잘 모르겠네요.

jinyeong의 이미지

struct XXX = { 
    aaa : bbb, 
    
    ... 
};

linux kernel에서 자주 보실 수 있습니다.

gcc extension으로 알고 있습니다.

struct XXX = { 
    .aaa = bbb, 
    
    ... 
};

와 같을겁니다.

I thought what I'd do was,
I'd pretend I was one of those deaf-mutes.. or should I?

bugiii의 이미지

그런게 있었군요. 등호가 위에 있었군요... 몰라봐서 죄송합니다. 부끄... :oops:

BlackTiger의 이미지

특정 장비에 포팅할 커널소스를 분석중에 있습니다.
머리에 불날거 같아여..^^;;

답변주신 분들 감사합니다..

댓글 달기

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
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.