질문임다..... long 형 이 왜......

익명 사용자의 이미지


리눅스 사용하고 있는데요..

long 형의 싸이즈가 왜 4바이트죠?ㅡㅡ;;

int 도 4바이트고 같내요....ㅡㅡ;;

long 형은 int 의 두배라고 알고 있었는데.. 어떻게 된거죠?

익명 사용자의 이미지

자료형의 크기는 Machine( compiler ) 마다 다릅니다.

이렇게 해보세요.

printf( "char size = [%d]\n", sizeof( char ) );
printf( "int size = [%d]\n", sizeof( int ) );
.
.
.
printf( "long double size = [%d]\n", sizeof( long double ) );

이상 입니다.

익명 사용자의 이미지

long 형은 16bit 기계일때는 소프트웨어적으로 32bit 을 만들어 썼지만,
요상하게두 ( 추측입니다만 32bit 이상의 수치의 의미가 별로 없어졌거
나, 기존 16bit 기계와의 long type 의 호환적인 측면 에서 ) 32bit 을
쓰네여..,

C 의 Int type 은 size 의 고정의 의미가 아니라, 산술 레지스터의 크기
여서 32 bit 기계에서는 32bit 처리를 16bit 에서는 16bit 이 int type
의 기본이 되는것 같네여...,

VC 에서는 __int64 라는 type 을 64bit 정수형을 기본으루 제공하네
여..., 혹시 linux 64bit int type 을 아시면 답점 해주세여....

익명 사용자의 이미지

gcc 컴파일러는 long 의 두배 크기인 long long 타입을 지원합니다.

대부분의 32비트 아키텍쳐는 ILP32 (integer long pointer 가 32비트인
시스템) 아키텍쳐입니다.

몇몇 64비트 아키텍쳐는 LP64 모델로 알려져 있지요. 이 때는 다시
integer 가 32비트이고 long 은 그 두배인 64 bit 가 됩니다.

익명 사용자의 이미지

며칠전에 Sun 8에서 테스트해봤는데
32bit 에서는
int 4bytes
long 4bytes (= long int)
long long 8bytes
double 8bytes
long double 16bytes
64bit 에서는
int 4bytes
long 8bytes (= long int)
long long 8bytes
double 8bytes
long double 16bytes
였던걸로 기억합니다만
확실하게 sizeof typename 해보십시오.
(컴파일할때 32bits는 그냥, /64bits는 별도 옵션필요)

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.