1. Words
- impeccable: perfect, with no problems or bad parts, 흠 잡을 데 없는.
- spell: to form a words with the letters in the correct order, 철자를 말하다, 철자를 맞게 쓰다, 맞춤법에 맞게 쓰다.
- inseparably: in a way that cannot be separated. 불가분한
- to the [such an] extent that: to a particular degree or stage, often causing particular result. ~ 할 정도까지, ~한 결과로, ~인 한, ~의 범위에서
- thoroughly: completely, very much: 대단히, 완전히, 철저히, 철두철미하게
- stand out: to be very noticeable, to be much better than other similar things or people. 튀어나오다; 눈에 띄다, 빼어나다, 견디다, 주장하다.
- in terms of: in relation to something, ~면에서 [~에 관하여]
- implications: 결과, 영향. an occasion when you seem to suggest something without saying it directly. 함축, 암시
- Synecdoche: 제유, 사물의 한 부분으로써 그 사물 전체를 가리키거나, 그 반대로 전체로써 부분을 가리켜 비유하는 것. 예를 들어, Austrailia lost by two goals (오스트레일리아가 두 골 차이로 졌다) 에서 Australia 는 Australia team 을 의미함.
Synecdoche is a literary device, somewhat like a smile or a metaphor, in which, according to the oxford english dictionary "a more comprehensive term is used for a less comprehensive on vice versa; as whole for part or part for whole, genus for species or species for genus, etc."
- eschew: 피하다, 삼가다
- genus: 속
- species: 종
- literary device: 문학적인 장치
- simile: 직유
- metaphore: 은유
- comprehensive: 포괄적인
- cloberring: (사람을) 두들겨 패다.
(특히 경제적으로) 호된 처벌[손실]을 가하다.
(사람의) 의복 [장비] (= stuff)
- neophyte: a person who is new to a subject, skill or belief, 초보자, 신개종자.
- appreciate:
1. recognize the full worth of
2. understand (a situation) fully; recognize the full implications of
3. rise in value or price
- 진가를 인정하다 [식별하다], 좋은 점을 인정하다, 올바르게 인식하다. 시세를 올리다, 값을 올리다.
- fencepost errors: alos called off-by-one-errors. is a logic error involving the discrete equivalent of a boundary condition. It often occurs in computer programming when an iterative loop iterates one time too many or too few.
- account:
1. a report or description of an event or experience.
2. a record or statement of financial expenditure and receipts.
3. consider or regard in a specified way.
- 책음을 지다, 용도에 대해 설명하다, 용도에 대해 보고하다, 처리에 대해 설명하다, 처리에 대해 보고하다.
- extrapolate: 외삽하다, 외삽법에 의해 추정하다, 외삽법을 행하다, 보외법을 행하다. (~을 기반으로) ~에 의해 추론하다.
- extend the application of (a method or conclusion, especially one based on statistics) to an unknown situation by assumming that existing trends will continue or similar methods will be applicable.
- trivial: of littel value or important, 하찮은, 진부한.
- tempting: 유혹하다.
- preliminary: 예비의
- out of the way:
1. (더 이상 방해가 안 되도록) 비키어
2. 끝난[처리된]
3. (부정문에서) 평상시와는 다른[이상한]
- retain: 유지하다.
- consecutive: 연이은
- responsible:
1. (~을) 책임지고[책임맡고]있는
2. (~에 대해) 책임이 있는 [책임져야 할]
3. (~의) 원인이 되는
- forestall: 미연에 방지하다.
- literal minded: 상상력이 없는, 무미건조한.
- pad something out:
1. (옷의 모양을 잡기 위해) 패드[심]를 대다.
2. (글 등을 더 길게 만들거나 그럴싸하게 보이도록) 군더더기를 덧붙이다, [내용을 부풀리다]
- substitude:
1. 대신하는 사람[것], 대리자;
2. 교체 선수
3. 대신하다, 대치[교체]되다; 대용[교체/대치]하다.
- nor: ~로 (또한) 아니다[없다], (~이 아닌 것은) ~도 그렇다[마찬가지이다].
- sought: seek 의 과거, 과거분사
- subtle:
1. 미묘한, 감지하기 힘든
2. 교모한, 영리한
3. 절묘한.
- presume: (실질적인 증거는 없지만 사실일 것이라고) 추정하다 [여기다/생각하다]
2. Summery
- 1. Pointers and arrays
- C has only one-dimensional arrays, and the size of an array must be fixed as a constant at compilation time. However, an element of an array may be an object of any type, including another array; this makes it possible to simulate multi-dimensional arrays fairly easily.
- Only two things can be done to an array: determine its size and obtain a pointer to element 0 of the array. All other array operations are actually done with pointers, even if they are written with what look like subscripts. That is, every subscript operation is equivalent to a pointer operation, so it is possible to define the behavior of subscripts entirely in terms of the behavior of pointers.
단, 1번의 array must be fixed as a constant at compilation time. 은 C99 의 VLA(Variable-Length Array) 에 등장으로 인해 잘못된 설명이 될 수도 있다.
2. Pointers are not arrays
The title says it all.
3. Array declarations as parameters
In other words, writing
int
strlen(char s[])
{
}
is precisely equivalent to writing
strlen(char *s)
{
}
C programmers often suppose, incorrectly, that this automatic conversion applies in other contexts as well. Section 4.5 (page 63) discusses one particularly common trouble spot in more detail:
extern char *hello;
is definitely not the same as
extern char hello[];
- 4. Eschew Synecdoche
The thing to remember is that copying a pointer does not copy the thing it addresses.
- 5. Null pointers are not null strings
The title says it all.
- 6. Counting and asymmetric bounds
Among common programming errors, the hardest to find are usually fencepost errors, also called off-by-one errors. These two ways of solving this problem suggest two general principles for avoiding fencepost errors:
- Extrapolate from a trivial case.
- Count carefully.
Minght there be some programming technique that makes these errors less likely? There is, and a single rule covers it:
Express a range by the first element of the range and the first element beyond it.
x >= 16 and x <= 37
instead
x >= 16 and x < 38
- The size of a range is the difference between the bounds. 38 - 16 is 22, the number of elements contained between the asymmetric bounds 16 and 38.
- The bounds are equal when the range is empty. This follows immediately from (1)
- The upper bound is never less than the lower bound, not even when the range is empty.
- 7. Order of evaluation
Only the four C operators &&
, ||
, ?:
, and ,
specify an order of evaluation. All other C operators evaluate their operands in undefined order
.
The &&
and ||
operators are important for ensuring that tests are applied in the right sequence. For instance, in
if (y != 0 && x/y > tolerance)
complain();
it is essential to evaluate x/y
only if y
is nonzero.
The following way of copying the first n
elements of array x
to array y
is incorrect because it assumes too much about order of evaluation:
i = 0;
while (i < n)
y[i] = x[i++];
The trouble is that there is no guarantee that the address of y[i]
will be evaluated before i
is incremented. On some implementations, it will; on others, it won't.
- 8. The &&
, ||
, and !
operators
A programmer who substitutes one of these operators for the corresponding operator from the other class may be in for a surprise: the program may appear to work correctly after such an interchange but may actually be working only by coincidence.
아래는 재미있어서 가져온 코드:
i = 0;
while (i < tabsize && tab[i] != x)
i++;
The idea behind this loop is that if i
is equal to tabsize
when the loop terminates, then the element sought was not found. Otherwise, i
contains the element's index.
- 9. Integer overflow
Overflow can occur if both operands are signed; the result of an overflow is undefined.
One correct way of doing this is to convert a
and b
to unsigned:
if ((unsigned) a + (unsigned) b > INT_MAX)
complain();
Here, INT_MAX
is a defined constant that represents the largest possible int
value. ANSI C defines INT_MAX
in <limits.h>
; you may have to defin e it yourself on other implementations.
Another possibility doesn't involve unsigned arithmetic at all:
if (a > INT_MAX - b)
complain();
- 10. Returning a value from main
A program that doesn't return any value from main
thus probably appears to have failed. This may cause surprising results when used with things like software administration systems that care about whether programs fail after they have invoked them.
3. Exercises
https://www.mythos-git.com/Cruzer-S/CTAP/-/tree/main/Chapter03
4. Reference
[Book] C Traps and Pitfalls (Andrew Koenig)
[Site] Google Translate
[Site] Cambridge Dictionary
[Site] 네이버 영영사전, 영한사전
[Site] https://en.wikipedia.org/wiki/Off-by-one_error