long long extended type in c89?

Discussion in 'C Programming' started by j, Aug 23, 2003.

  1. j

    j Guest

    Sadly, I don't have a copy of the c89 standard, just a copy of the c99
    standard. I was curious if in c89, the type ``long long'' is indeed
    considered an extended type that may or may not be implemented by the
    implementation? And if it states whether or not the size of ``long
    long'' is equal to the size of ``long'' or can be greater than the
    size there-of?
     
    j, Aug 23, 2003
    #1
    1. Advertisements

  2. j

    Kevin Easton Guest

    Jack Klein <> wrote:
    > On 23 Aug 2003 15:54:02 -0700, (j) wrote in
    > comp.lang.c:
    >
    >> Sadly, I don't have a copy of the c89 standard, just a copy of the c99
    >> standard. I was curious if in c89, the type ``long long'' is indeed
    >> considered an extended type that may or may not be implemented by the
    >> implementation? And if it states whether or not the size of ``long
    >> long'' is equal to the size of ``long'' or can be greater than the
    >> size there-of?

    >
    > The original C standard, as well as the C99 standard, allow a
    > conforming implementation to provide extensions as long as they do not
    > impact any strictly conforming program.
    >
    > Using the keyword long twice within one declaration is an error in a
    > pre-C99 keyword, so an implementation is free to provide a type named
    > "long long" as an extension. Since it is completely an extension, it
    > can be anything at all that the implementation wants it to be.


    I believe, as a syntax error, that it must be diagnosed.

    - Kevin.
     
    Kevin Easton, Aug 24, 2003
    #2
    1. Advertisements

  3. j

    j Guest

    Jack Klein <> wrote in message news:<>...
    > On 23 Aug 2003 15:54:02 -0700, (j) wrote in
    > comp.lang.c:
    >
    > > Sadly, I don't have a copy of the c89 standard, just a copy of the c99
    > > standard. I was curious if in c89, the type ``long long'' is indeed
    > > considered an extended type that may or may not be implemented by the
    > > implementation? And if it states whether or not the size of ``long
    > > long'' is equal to the size of ``long'' or can be greater than the
    > > size there-of?

    >
    > The original C standard, as well as the C99 standard, allow a
    > conforming implementation to provide extensions as long as they do not
    > impact any strictly conforming program.
    >
    > Using the keyword long twice within one declaration is an error in a
    > pre-C99 keyword, so an implementation is free to provide a type named
    > "long long" as an extension. Since it is completely an extension, it
    > can be anything at all that the implementation wants it to be.
    >
    > Prior to C99, there was a DR that stated that no standard integer type
    > could be "longer" than long, i.e., size_t, ptrdiff_t, and so on. But
    > a "long long" type in a pre-C99 compiler would be an extension, not a
    > standard type, and the only limitation placed on extensions is the one
    > above.



    That is what I was looking for. Thanks Jack. :)
     
    j, Aug 24, 2003
    #3
  4. j

    Jack Klein Guest

    On Sun, 24 Aug 2003 11:34:25 GMT, Kevin Easton
    <> wrote in comp.lang.c:

    > Jack Klein <> wrote:
    > > On 23 Aug 2003 15:54:02 -0700, (j) wrote in
    > > comp.lang.c:
    > >
    > >> Sadly, I don't have a copy of the c89 standard, just a copy of the c99
    > >> standard. I was curious if in c89, the type ``long long'' is indeed
    > >> considered an extended type that may or may not be implemented by the
    > >> implementation? And if it states whether or not the size of ``long
    > >> long'' is equal to the size of ``long'' or can be greater than the
    > >> size there-of?

    > >
    > > The original C standard, as well as the C99 standard, allow a
    > > conforming implementation to provide extensions as long as they do not
    > > impact any strictly conforming program.
    > >
    > > Using the keyword long twice within one declaration is an error in a
    > > pre-C99 keyword, so an implementation is free to provide a type named
    > > "long long" as an extension. Since it is completely an extension, it
    > > can be anything at all that the implementation wants it to be.

    >
    > I believe, as a syntax error, that it must be diagnosed.
    >
    > - Kevin.


    Look at paragraphs 4 and 5 of Section 4 (C99):

    "A strictly conforming program shall use only those features of the
    language and library specified in this International Standard."

    ---and---

    "A conforming implementation may have extensions (including additional
    library functions), provided they do not alter the behavior of any
    strictly conforming program."

    I would say that a program containing a syntax error is *NOT* a
    strictly conforming program (first quotation). Therefore a conforming
    implementation is free to make an extension out of something that
    would otherwise be a syntax error.

    --
    Jack Klein
    Home: http://JK-Technology.Com
    FAQs for
    comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
    comp.lang.c++ http://www.parashift.com/c++-faq-lite/
    alt.comp.lang.learn.c-c++ ftp://snurse-l.org/pub/acllc-c++/faq
     
    Jack Klein, Aug 25, 2003
    #4
  5. j

    Kevin Easton Guest

    Jack Klein <> wrote:
    > On Sun, 24 Aug 2003 11:34:25 GMT, Kevin Easton
    > <> wrote in comp.lang.c:
    >
    >> Jack Klein <> wrote:
    >> > On 23 Aug 2003 15:54:02 -0700, (j) wrote in
    >> > comp.lang.c:
    >> >
    >> >> Sadly, I don't have a copy of the c89 standard, just a copy of the c99
    >> >> standard. I was curious if in c89, the type ``long long'' is indeed
    >> >> considered an extended type that may or may not be implemented by the
    >> >> implementation? And if it states whether or not the size of ``long
    >> >> long'' is equal to the size of ``long'' or can be greater than the
    >> >> size there-of?
    >> >
    >> > The original C standard, as well as the C99 standard, allow a
    >> > conforming implementation to provide extensions as long as they do not
    >> > impact any strictly conforming program.
    >> >
    >> > Using the keyword long twice within one declaration is an error in a
    >> > pre-C99 keyword, so an implementation is free to provide a type named
    >> > "long long" as an extension. Since it is completely an extension, it
    >> > can be anything at all that the implementation wants it to be.

    >>
    >> I believe, as a syntax error, that it must be diagnosed.
    >>
    >> - Kevin.

    >
    > Look at paragraphs 4 and 5 of Section 4 (C99):
    >
    > "A strictly conforming program shall use only those features of the
    > language and library specified in this International Standard."
    >
    > ---and---
    >
    > "A conforming implementation may have extensions (including additional
    > library functions), provided they do not alter the behavior of any
    > strictly conforming program."
    >
    > I would say that a program containing a syntax error is *NOT* a
    > strictly conforming program (first quotation). Therefore a conforming
    > implementation is free to make an extension out of something that
    > would otherwise be a syntax error.


    I point you to Section 5 (I'm quoting here from N869):

    5.1.1.3 Diagnostics
    1 A conforming implementation shall produce at least one diagnostic
    message (identified in an implementation-defined manner) if a
    preprocessing translation unit or translation unit contains a violation
    of any syntax rule or constraint, even if the behavior is also
    explicitly specified as undefined or implementation-defined. Diagnostic
    messages need not be produced in other circumstances.

    (So an implementation can indeed provide a long long type, but it has to
    say something like "Warning: You used the long long type!").

    - Kevin.
     
    Kevin Easton, Aug 25, 2003
    #5
  6. Groovy hepcat j was jivin' on 23 Aug 2003 15:54:02 -0700 in
    comp.lang.c.
    long long extended type in c89?'s a cool scene! Dig it!

    >Sadly, I don't have a copy of the c89 standard, just a copy of the c99
    >standard. I was curious if in c89, the type ``long long'' is indeed
    >considered an extended type that may or may not be implemented by the
    >implementation? And if it states whether or not the size of ``long
    >long'' is equal to the size of ``long'' or can be greater than the
    >size there-of?


    It is not mentioned at all in C89.

    --

    Dig the even newer still, yet more improved, sig!

    http://alphalink.com.au/~phaywood/
    "Ain't I'm a dog?" - Ronny Self, Ain't I'm a Dog, written by G. Sherry & W. Walker.
    I know it's not "technically correct" English; but since when was rock & roll "technically correct"?
     
    Peter Shaggy Haywood, Aug 26, 2003
    #6
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. George Marsaglia

    Assigning unsigned long to unsigned long long

    George Marsaglia, Jul 8, 2003, in forum: C Programming
    Replies:
    1
    Views:
    982
    Eric Sosman
    Jul 8, 2003
  2. Christian Seberino
    Replies:
    8
    Views:
    675
    =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=
    Feb 11, 2004
  3. Chris Croughton

    long double in C89?

    Chris Croughton, Jan 6, 2005, in forum: C Programming
    Replies:
    7
    Views:
    686
    Chris Croughton
    Jan 8, 2005
  4. G Patel
    Replies:
    1
    Views:
    716
  5. Daniel Rudy

    unsigned long long int to long double

    Daniel Rudy, Sep 19, 2005, in forum: C Programming
    Replies:
    5
    Views:
    1,583
    Peter Shaggy Haywood
    Sep 20, 2005
  6. Yevgen Muntyan

    C89, size_t, and long

    Yevgen Muntyan, Mar 14, 2007, in forum: C Programming
    Replies:
    73
    Views:
    2,785
    Steve Thompson
    Mar 19, 2007
  7. Mathieu Dutour

    long long and long

    Mathieu Dutour, Jul 17, 2007, in forum: C Programming
    Replies:
    4
    Views:
    707
    santosh
    Jul 24, 2007
  8. Bart C

    Use of Long and Long Long

    Bart C, Jan 9, 2008, in forum: C Programming
    Replies:
    27
    Views:
    1,252
    Peter Nilsson
    Jan 15, 2008
Loading...