반응형

 

 

 

 

 

STM32F103을 System Workbench compiler에서 코딩을 하다가 변수 타입이 궁금해서 확인해 보았다.

int8_t, int16_t, int32_t 등등...

변수명만 보아도 어떤 내용인지 잘 알겠는데 이것이 어디에 정의되어 있는 것일까?

 

아래의 위키에 이 내용이 아주 잘 설명되어 있다.

 

en.wikipedia.org/wiki/C_data_types

 

C data types

In the C programming language, data types constitute the semantics and characteristics of storage of data elements. They are expressed in the language syntax in form of declarations for memory locations or variables. Data types also determine the types of

en.wikipedia.org

 

The C99 standard includes definitions of several new integer types to enhance the portability of programs.

 

C99 표준에 이 새로운 타입의 정의가 포함되어 있다.

 

 All new types are defined in <inttypes.h> header (cinttypes header in C++) and also are available at <stdint.h> header (cstdint header in C++). The types can be grouped into the following categories:

 

inttypes.h 와 stdint.h 에 정의되어 있다고 하니 찾아봐도 되겠다.

 

intn_t : 정확한 너비의 integer type으로 n 비트와 같은 수의 정확한 너비를 보장한다.

나머지는 아래 내용 참고.

 

포인터형도 정의되어 있다. 

각 데이터 타입에 대해 MIN, MAX 값도 정의되어 있으니 참고하자. 

 

  • Exact-width integer types that are guaranteed to have the same number n of bits across all implementations. Included only if it is available in the implementation.
  • Least-width integer types that are guaranteed to be the smallest type available in the implementation, that has at least specified number n of bits. Guaranteed to be specified for at least N=8,16,32,64.
  • Fastest integer types that are guaranteed to be the fastest integer type available in the implementation, that has at least specified number n of bits. Guaranteed to be specified for at least N=8,16,32,64.
  • Pointer integer types that are guaranteed to be able to hold a pointer. Included only if it is available in the implementation.
  • Maximum-width integer types that are guaranteed to be the largest integer type in the implementation.

The following table summarizes the types and the interface to acquire the implementation details

(n refers to the number of bits : n이 비트 수 이다.):

 

 

 

 

 

 

 

728x90
반응형

+ Recent posts