콘텐츠로 이동

잼잇는 정보

잼잇는 정보

배열이 집합(Set)으로부터 다른 점

[iOS] 배열, 집합, 튜플 자료형

음수값의 부호있는 정수를 불안전하게 부호없는 정수로 변환할 경우 일어나는 일

c - What happens when I assign a negative value to an unsigned int? - Stack Overflow
Compiler warning (level 2) C4146 | Microsoft Learn

Visual Studio에서는 부호 없는 정수에 단항 마이너스 연산자를 사용하면 에러가 발생합니다(C4146).
제일 도움된 문서
c++ - Casting negative integer to larger unsigned integer - Stack Overflow

This is a good question and the draft C++ standard on this section 4.7 Integral conversions which says:

If the destination type is unsigned, the resulting value is the least unsigned integer congruent to the source integer (modulo 2n where n is the number of bits used to represent the unsigned type).[…]

is not the most straight forward to interpret, in this case I would go back to the draft C99 standard which say

Otherwise, if the new type is unsigned, the value is converted by repeatedly adding or subtracting one more than the maximum value that can be represented in the new type until the value is in the range of the new type. 49

where footnote 49 helpfully says:

The rules describe arithmetic on the mathematical value, not the value of a given type of expression.

This is more straight forward and clearly gives us the result as 음수 + MAX + 1 which is MAX, regardless of what type of the operand is.

Pasted image 20221217191242.png

음수 + 부호없는 정수의 Max(4294967295) + 1 로 나옴 개신기 ㄷ

GDB online Debugger | Code, Compile, Run, Debug online C, C++
Pasted image 20221217191704.png

4294967295 - 65 + 1

생각해보니 걍 2의 보수 읽어서 그런거임

파일 I/O와 네트워크 I/O

네트워크 I/O 개념 - Win32 apps | Microsoft Learn

데이터를 문자열이 아닌 바이트 단위로 읽는다.

파일 버퍼링~

브라우저 Url 입력

웹 브라우저에 URL을 입력하면 어떤 일이 생기나요? | Amazon Web Services 한국 블로그

SQL에서 결합구문을 사용하는 예

취미는 공부 특기는 기록 :: 인덱스를 사용하지 못하는 경우, 분포도
[sql server - Applying indexes on columns used in join condition - Database Administrators Stack Exchange](https://dba.stackexchange.com/questions/180295/applying-indexes-on-columns-used-in-join-condition
Indexes and Joins | ITPro Today: IT News, How-Tos, Trends, Case Studies, Career Tips, More

인덱스 거는건 오히려 조인 걸 때 좋다

join on , where 차이점
SQL Joins Using WHERE or ON | Intermediate SQL - Mode

각 테이블의 기본 키 컬럼을 이용해 두 테이블을 결합하며 WHERE 구문을 사용하는 것
각 테이블의 인덱스된 컬럼을 이용해 두 테이블을 결합하는 것
한 테이블의 기본 키 컬럼과 다른 테이블의 인덱스된 컬럼을 이용해 두 테이블을 결합하는 것
각 테이블의 기본 키 컬럼을 이용해 두 테이블을 결합하는 것

→ 한 테이블에 대한 하위쿼리 결과를 다른 테이블과 결합할 때 해당 테이블의 기본 키 컬럼을 이용하는 것 (틀린 예)

UTF-8

unicode - UTF-8, UTF-16, and UTF-32 - Stack Overflow

단일 CPU 에서 적절하지 않은 것

The least appropriate task to do on a single-core CPU would be option 2:
Initiate a multi-threaded connection to download multiple files.

Multi-threaded tasks involve dividing a task into smaller parts that can be processed concurrently by multiple threads. On a single-core CPU, only one thread can be executed at a time, so using multiple threads would not provide any benefits in terms of performance.

Option 1: Write data to a network file descriptor,
option 3: All pixels in the picture are approached sequentially along the length and width,
option 4: A single file is read in chunks using multiple threads, and option 5: Multiple threads are used to find the sum of the array values multiplied by a constant, can all be performed effectively on a single-core CPU.

네트워크 파일 서술자에 데이터를 쓴다.
사진의 모든 픽셀을 가로 세로 길이에 따라 순차적으로 접근한다.
하나의 파일을 다중스레드를 이용하여 덩어리로 나누어 읽어 들인다.
배열 값의 합을 상수로 곱한 값을 구하기 위해 다중스레드를 사용한다.

여러개의 파일을 다운로드 받기 위해 다중스레드 연결을 시작한다.


마지막 업데이트 : 2025년 4월 23일
작성일 : 2023년 1월 29일