닷 연산자(dot operator)에 대한 질문을 올렸었다.
http://gall.dcinside.com/board/view/?id=programming&no=604718&page=3
아래 링크가 좋은 답변이 되었다.
http://stackoverflow.com/questions/8047261/what-does-dot-mean-in-a-struct-initializer
http://gcc.gnu.org/onlinedocs/gcc/Designated-Inits.html
보답으로 영알못 프게이들을 위해 헌신한다
6.27 Designated Initializers (지정된 초기화)
Standard C90 requires the elements of an initializer to appear in a fixed order,
the same as the order of the elements in the array or structure
being initialized.
(표준 C90은 이니셜라이저의 요소가 고정된 순서로 나타날 것을 요구한다,
어떤 순서냐면 배열이나 구조체가 초기화 됐을 때의 그 순서)
In ISO C99 you can give the elements in any order,
specifying the array indices or structure field names they apply to,
and GNU C allows this as an extension in C90 mode as well.
(ISO C99에서는 니 맘대로 요소를 나열할 수 있다,
대신 배열이면 인덱스값으로, 구조체면 필드 이름으로 명시해줘야 된다,
GNU C 에서도 C90의 확장으로 쓸 수 있는게 꿀팁이다.)
This extension is not implemented in GNU C++.
(GNU C++에서는 안된다.)
To specify an array index, write ‘[index] =’ before the element value. For example
(배열에서 쓰려면 이렇게 써라)
is equivalent to
(이것도 된다)
The index values must be constant expressions,
even if the array being
initialized is automatic.
(인덱스 값은 상수 표현이어야된다,
배열 초기화를 자동화 시켜놨더라도ㅡfor문 돌리면서 인덱스 변수로 쓰지 말란 소리)
An alternative syntax for this
that has been obsolete since GCC 2.5
but
GCC still accepts is to write ‘[index]’ before the element
value, with no ‘=’.
(대안으로 쓸 수 있는 문법이 있다
GCC 2.5 부터는 쓸모없어졌지만 그래도 아직 GCC가 받아들이기는 하는
뭐냐면 요소 값 앞에 '=' 없이 '[index]' 쓰는 방법임)
To initialize a range of elements to the same value, write
‘[first ... last] = value’. This is a GNU
extension. For example,
(범위 초기화도 할수 있다. 이렇게 해라)
If the value in it has side-effects, the side-effects happen only once,
not for each initialized field by the range initializer.
(만약 사이드이펙트를 가지고 있는 값이라면, 사이드이펙트는 한번만 일어난다,
범위 초기화에 걸친 필드 각각마다 매번 일어나는게 아니라)
Note that the length of the array is the highest value specified
plus one.
(배열 길이는 제일 큰 인덱스에 1 더한 값이라는거에 주의해라ㅡ배열 인덱스는 0부터 시작하니까)
In a structure initializer, specify the name of a field to initialize with ‘.fieldname =’ before the element value.
(구조체 초기화는)
For example,
given the following structure,
(아래같은게 있으면)
the following initialization
(이렇게 쓰거나)
is equivalent to
(이렇게 써라)
Another syntax that has the same meaning, obsolete since GCC 2.5, is
‘fieldname:’, as shown here:
(구식이지만 이것도 된다)
Omitted field members are implicitly initialized the same as objects that have static storage duration.
The ‘[index]’ or ‘.fieldname’ is known as a designator. You can also use a designator (or the obsolete colon syntax) when initializing a union, to specify which element of the union should be used. For example,
union foo { int i; double d; }; union foo f = { .d = 4 };converts 4 to a double to store it in the union using the second element. By contrast, casting 4 to type union foo stores it into the union as the integer i, since it is an integer. (See Cast to Union.)
You can combine this technique of naming elements with ordinary C initialization of successive elements. Each initializer element that does not have a designator applies to the next consecutive element of the array or structure. For example,
int a[6] = { [1] = v1, v2, [4] = v4 };is equivalent to
int a[6] = { 0, v1, v2, 0, v4, 0 };Labeling the elements of an array initializer is especially useful when the indices are characters or belong to an enum type. For example:
int whitespace[256] = { [' '] = 1, [' '] = 1, ['h'] = 1, [''] = 1, [' '] = 1, [' '] = 1 };You can also write a series of ‘.fieldname’ and ‘[index]’ designators before an ‘=’ to specify a nested subobject to initialize; the list is taken relative to the subobject corresponding to the closest surrounding brace pair. For example, with the ‘struct point’ declaration above:
struct point ptarray[10] = { [2].y = yv2, [2].x = xv2, [0].x = xv0 };If the same field is initialized multiple times, it has the value from the last initialization. If any such overridden initialization has side-effect, it is unspecified whether the side-effect happens or not. Currently, GCC discards them and issues a warning.
근데 헌신하다 귀찮아져서 그만한다
ㅅㄱ
영알못은 이바닥에서 일하면 안됨
영어 좆도 못하는데다가 용어도 다 틀리게 번역해놨네
equivalent랑 automatic에서 좆도아닌 개소리를 설명이라고 달아놓은거보고 기겁했다
왜살아? 그런 실력으로 번역해준다고 나대면 쪽팔리지도 않냐?
낄낄낄