who decides the size of a data type?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • rao

    who decides the size of a data type?

    On some of the compilers integer size is 2 and on some other it is 4
    bytes.
    My doubt is who decides the size of the integer?
    is it plainly the compiler?
    Does OS or Processor also has any control in deciding the size of such
    data types?
  • Willem

    #2
    Re: who decides the size of a data type?

    rao wrote:
    ) On some of the compilers integer size is 2 and on some other it is 4
    ) bytes.

    And on some, it is 8. And on very few others, it's another number.

    ) My doubt is who decides the size of the integer?

    In India, do 'doubt' and 'question' translate to the same word ?
    In any case, the right word to use in English is 'question'.

    ) is it plainly the compiler?
    ) Does OS or Processor also has any control in deciding the size of such
    ) data types?

    Usually, the compiler decides the size, based on what the OS and/or
    the processor have to offer. I think the C standard even strongly
    suggests that 'int' be the size that is 'most natural' to the system.

    However, it is ultimately the compiler that makes the decision.
    For example, there are systems that have 'natural' 8-byte integers,
    but a lot of C compilers still use 4-byte int types.


    SaSW, Willem
    --
    Disclaimer: I am in no way responsible for any of the statements
    made in the above text. For all I know I might be
    drugged or something..
    No I'm not paranoid. You all think I'm paranoid, don't you !
    #EOT

    Comment

    • Gordon Burditt

      #3
      Re: who decides the size of a data type?

      >On some of the compilers integer size is 2 and on some other it is 4
      >bytes.
      There are other possibilities. Don't be surprised to see 8 in the
      future. And 3 isn't impossible.
      >My doubt is who decides the size of the integer?
      The compiler writer. But some choices make his job easier than others.
      >is it plainly the compiler?
      >Does OS or Processor also has any control in deciding the size of such
      >data types?
      The choice is heavily influenced by such things as the size of
      machine registers, the instruction set of the machine, and the
      interface the OS provides. It is possible, for example, to provide
      an integer of size 3 (3 11-bit characters) on an Intel x86 machine,
      but the code will not be very efficient and it may be wasteful of
      storage. You can emulate one machine on another, and generate code
      for the emulated machine, but that's a lot of effort and no guarantee
      of efficiency.




      Comment

      • santosh

        #4
        Re: who decides the size of a data type?

        rao wrote:
        On some of the compilers integer size is 2 and on some other it is 4
        bytes.
        My doubt is who decides the size of the integer?
        is it plainly the compiler?
        Does OS or Processor also has any control in deciding the size of such
        data types?
        Generally both. Most compilers map C's numeric types to the underlying
        hardware types in the most efficient manner possible. Usually the type
        char is aliased to the machine's byte while the type int corresponds to
        the native word of the processor. Other types may vary. Main concerns
        for implementors are to avoid breaking existing code and to provide as
        much efficiency as possible.

        The Standard of course specifies the minimum ranges for these types
        which every conforming compiler must adhere to.

        Comment

        • harsha

          #5
          Re: who decides the size of a data type?

          On Mar 16, 8:31 pm, Willem <wil...@stack.n lwrote:
          <snip>
          In India, do 'doubt' and 'question' translate to the same word ?
          In any case, the right word to use in English is 'question'.
          When in doubt, we ask a question.

          Comment

          • Wolfgang Draxinger

            #6
            Re: who decides the size of a data type?

            santosh wrote:
            Usually the type char is aliased to the machine's
            byte while the type int corresponds to the native word of the
            processor.
            Not to forget that some architectures provide special functions
            to operate on strings, which have some constraints on the type
            (like each element of a string being a byte of 8 bits). It makes
            quite some sense if an C implementation uses this type then for
            char.

            Wolfgang Draxinger
            --
            E-Mail address works, Jabber: hexarith@jabber .org, ICQ: 134682867

            Comment

            • CBFalconer

              #7
              Re: who decides the size of a data type?

              Willem wrote:
              rao wrote:
              >
              >On some of the compilers integer size is 2 and on some other it
              >is 4 bytes.
              >
              And on some, it is 8. And on very few others, it's another number.
              >
              >My doubt is who decides the size of the integer?
              >
              In India, do 'doubt' and 'question' translate to the same word ?
              In any case, the right word to use in English is 'question'.
              No, Willem. The phrases "I have a doubt" and "my doubt" are quite
              ordinary English usage. They are more popular in India than in
              most other English speaking areas. I concede that many native
              English speakers don't recognize that, but their ignorance is of no
              concern. You, apparantly, are Dutch, and have no reason to
              recognize the usage.

              At any rate, apply my favorite exorcism. Sedulously eschew
              obfuscation. :-)

              --
              [mail]: Chuck F (cbfalconer at maineline dot net)
              [page]: <http://cbfalconer.home .att.net>
              Try the download section.



              --
              Posted via a free Usenet account from http://www.teranews.com

              Comment

              • Keith Thompson

                #8
                Re: who decides the size of a data type?

                Willem <willem@stack.n lwrites:
                rao wrote:
                [...]
                ) My doubt is who decides the size of the integer?
                >
                In India, do 'doubt' and 'question' translate to the same word ?
                In any case, the right word to use in English is 'question'.
                [...]

                In Indian English, "doubt" is often used as a synonym for "question".
                In dialects of English outside India, "doubt" has a connotation of
                disbelief.

                Non-Indian readers need to understand this. Indian posters should, I
                suggest, try to use the word "question" rather than "doubt" when
                posting in international forums like this one to avoid confusion.

                --
                Keith Thompson (The_Other_Keit h) <kst-u@mib.org>
                Nokia
                "We must do something. This is something. Therefore, we must do this."
                -- Antony Jay and Jonathan Lynn, "Yes Minister"

                Comment

                • Richard Heathfield

                  #9
                  Re: who decides the size of a data type?

                  Keith Thompson said:

                  <snip>
                  In Indian English, "doubt" is often used as a synonym for "question".
                  In dialects of English outside India, "doubt" has a connotation of
                  disbelief.
                  >
                  Non-Indian readers need to understand this.
                  No. If non-Indian readers /do/ understand, it's a bonus, but it is *not* a
                  requirement. A seeker after (effective) help cannot get that help if he or
                  she does not make himself or herself understood. Thus, it is in the
                  seeker's interest to use English in the canonical way.

                  <snip>

                  --
                  Richard Heathfield <http://www.cpax.org.uk >
                  Email: -http://www. +rjh@
                  Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
                  "Usenet is a strange place" - dmr 29 July 1999

                  Comment

                  • William Ahern

                    #10
                    Re: who decides the size of a data type?

                    Richard Heathfield <rjh@see.sig.in validwrote:
                    Keith Thompson said:
                    <snip>
                    >
                    In Indian English, "doubt" is often used as a synonym for "question".
                    In dialects of English outside India, "doubt" has a connotation of
                    disbelief.

                    Non-Indian readers need to understand this.
                    No. If non-Indian readers /do/ understand, it's a bonus, but it is *not* a
                    requirement. A seeker after (effective) help cannot get that help if he or
                    she does not make himself or herself understood. Thus, it is in the
                    seeker's interest to use English in the canonical way.
                    So, before a poster can seek help in mastering the C language, they should
                    first master Oxford English?

                    The OP's intended meaning was clear from the context, if not from a
                    reasonable interpretation of the word itself. This case is entirely
                    different from someone using l33t speak, which is intended to _exclude_
                    readers, and where it might be reasonable to take offence at the person's
                    presumed motivation or impoliteness.

                    Comment

                    • jacob navia

                      #11
                      Re: who decides the size of a data type?

                      Keith Thompson wrote:
                      Willem <willem@stack.n lwrites:
                      >rao wrote:
                      [...]
                      >) My doubt is who decides the size of the integer?
                      >>
                      >In India, do 'doubt' and 'question' translate to the same word ?
                      >In any case, the right word to use in English is 'question'.
                      [...]
                      >
                      In Indian English, "doubt" is often used as a synonym for "question".
                      In dialects of English outside India, "doubt" has a connotation of
                      disbelief.
                      >
                      Non-Indian readers need to understand this. Indian posters should, I
                      suggest, try to use the word "question" rather than "doubt" when
                      posting in international forums like this one to avoid confusion.
                      >
                      Who cares about oxford english?

                      This is an international forum. It is enough that we have to use
                      english instead of a commonly recognized international language
                      like latin, french or esperanto

                      :-)



                      --
                      jacob navia
                      jacob at jacob point remcomp point fr
                      logiciels/informatique

                      Comment

                      • Ian Collins

                        #12
                        Re: who decides the size of a data type?

                        jacob navia wrote:
                        Keith Thompson wrote:
                        >Willem <willem@stack.n lwrites:
                        >>rao wrote:
                        >[...]
                        >>) My doubt is who decides the size of the integer?
                        >>>
                        >>In India, do 'doubt' and 'question' translate to the same word ?
                        >>In any case, the right word to use in English is 'question'.
                        >[...]
                        >>
                        >In Indian English, "doubt" is often used as a synonym for "question".
                        >In dialects of English outside India, "doubt" has a connotation of
                        >disbelief.
                        >>
                        >Non-Indian readers need to understand this. Indian posters should, I
                        >suggest, try to use the word "question" rather than "doubt" when
                        >posting in international forums like this one to avoid confusion.
                        >>
                        >
                        Who cares about oxford english?
                        >
                        The English inhabitants of Oxford?

                        --
                        Ian Collins.

                        Comment

                        • Richard Heathfield

                          #13
                          Re: who decides the size of a data type?

                          jacob navia said:

                          <snip>
                          This is an international forum. It is enough that we have to use
                          english instead of a commonly recognized international language
                          like latin, french or esperanto
                          >
                          :-)
                          fr.comp.lang.c exists.

                          --
                          Richard Heathfield <http://www.cpax.org.uk >
                          Email: -http://www. +rjh@
                          Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
                          "Usenet is a strange place" - dmr 29 July 1999

                          Comment

                          • jacob navia

                            #14
                            Re: who decides the size of a data type?

                            Ian Collins wrote:
                            jacob navia wrote:
                            >Who cares about oxford english?
                            >>
                            The English inhabitants of Oxford?
                            >
                            They do not read comp.lang.c anyway.


                            --
                            jacob navia
                            jacob at jacob point remcomp point fr
                            logiciels/informatique

                            Comment

                            • Chris Dollin

                              #15
                              Re: who decides the size of a data type?

                              jacob navia wrote:
                              Ian Collins wrote:
                              >jacob navia wrote:
                              >>Who cares about oxford english?
                              >>>
                              >The English inhabitants of Oxford?
                              >>
                              They do not read comp.lang.c anyway.
                              Why would my moving (back) to Oxford cause me to abandon this newsgroup?

                              --
                              "This instability seems a main source of its strength." /The Demon Breed/

                              Hewlett-Packard Limited Cain Road, Bracknell, registered no:
                              registered office: Berks RG12 1HN 690597 England

                              Comment

                              Working...