13 Within a structure object, the non-bit-field members and the units in which bit-fields reside have addresses that increase in the order in which they are declared. A pointer to a structure object, suitably converted, points to its initial member (or if that member is a
bit-field, then to the unit in which it resides), and vice versa. There may be unnamed padding within a structure object, but not at its beginning.
네 맞습니다. 항상 보장이 됩니다.C99 6.7.2.1 Struc
네 맞습니다. 항상 보장이 됩니다.
C99 6.7.2.1 Structure and union specifiers
13 Within a structure object, the non-bit-field members and the units in which bit-fields reside have addresses that increase in the order in which they are declared. A pointer to a structure object, suitably converted, points to its initial member (or if that member is a
bit-field, then to the unit in which it resides), and vice versa. There may be unnamed padding within a structure object, but not at its beginning.
[quote]기본적으로 구조체형의 멤버는 선언된 순서대로 메모리에 배
c 언어 펀더맨탈에는 저렇게 나와 있네요.
음 그렇다면 일단 보장받을수 있을것 같긴 한데...
(기본적으로라는 말은 근데 다르게도 할 수 있다는 뉘앙스가 ... 흠... 아닌가요)
----
use perl;
Keedi Kim
[quote="keedi"](기본적으로라는 말은 근데 다르게도 할 수 있
뉘앙스라는 것이 워낙 미묘해서 그렇게 해석될 수도 있는지 없는지 모르겠지만... ^^;
아닙니다.
구조체
답변 감사합니다.
제가 물어본 이유는..
C++의 인터페이스와 같은 느낌을.
C에서 살려보고자 함이었습니다.
여러개의 비슷한 성질의 구조체 앞단에
인터페이스 역할을 하는 구조체(함수 포인터로 이루어진)를 심어놓고
제어해보자는 취지였는데요.
몇가지 테스트를 해 본결과 만족스럽네요.
Object-Oriented Programming with ANSI C
Object-Oriented Programming with ANSI C 란 이름의 문서를 소개합니다.
중간부터 ooc 프리프로세서를 이용한 방법으로 변질되긴 하는데... 전반부의 내용은 제법 재미있습니다.
http://www.planetpdf.com/codecuts/pdfs/ooc.pdf
현재 하고 계신 일에 보탬이 되길 바랍니다. :-)
Re: 구조체
glib 과 gtk 가 그런 식으로 짜여져 있습니다 :)
덕분에 심심하면 타입캐스팅이 -_-;;;;;
오랫동안 꿈을 그리는 사람은 그 꿈을 닮아간다...
http://mytears.org ~(~_~)~
나 한줄기 바람처럼..
[quote="Anonymous"]Object-Oriented Progr
감사합니다~
많은 도움이 될 것 같습니다!
댓글 달기