c99 docs - any good?

Discussion in 'C Programming' started by mechanicfem@googlemail.com, Feb 20, 2006.

  1. Guest

    Lately I've been trying to learn about new stuff in c99 - today's topic
    was/is variable length arrays.

    As well as asking here, I've been 'doing the rounds' via Google, and
    recently I found this article:

    http://www.informit.com/guides/content.asp?g=cplusplus&seqNum=215

    It didn't help me much re my earlier question about using [*]

    However, could someone tell me if this article is /reasonable/?

    For example, the article mentions variadic macros, and __VA_ARGS__ -
    however, I cannot find __VA_ARGS__ in the draft ISO spec I have, and so
    I wonder if it's genuine?

    I've also noted a couple of things that don't make sense that 'make me
    wonder' about its quality, e.g.,

    struct Employee
    {
    ....
    }

    Followed by (note the missing /struct/)

    Employee emp = {.ID=0, .record=NULL};

    I guess my question really is - where can I find examples of /new/ c99
    features, c/w readable descriptions?

    x

    Jo

    P.S.

    Just noticed that the article says that long long is at least 64 bits,
    whereas the std says

    The rank of long long int shall be greater than the rank of long int,
    which
    shall be greater than the rank of int, which shall be greater than the
    rank of short
    int, which shall be greater than the rank of signed char.

    So, is there some error here too perhaps?
    , Feb 20, 2006
    #1
    1. Advertising

  2. Michael Mair Guest

    schrieb:
    > Lately I've been trying to learn about new stuff in c99 - today's topic
    > was/is variable length arrays.
    >
    > As well as asking here, I've been 'doing the rounds' via Google, and
    > recently I found this article:
    >
    > http://www.informit.com/guides/content.asp?g=cplusplus&seqNum=215
    >
    > It didn't help me much re my earlier question about using [*]
    >
    > However, could someone tell me if this article is /reasonable/?
    >
    > For example, the article mentions variadic macros, and __VA_ARGS__ -
    > however, I cannot find __VA_ARGS__ in the draft ISO spec I have, and so
    > I wonder if it's genuine?


    Search for "VA_ARGS" or "_VA_ARGS_" -- in order to make the number
    of _ apparent, tiny spaces have been inserted in the PDF version.

    I have not looked at the article, though. However, the cplusplus
    in its name makes me wonder.

    >
    > I've also noted a couple of things that don't make sense that 'make me
    > wonder' about its quality, e.g.,
    >
    > struct Employee
    > {
    > ...
    > }
    >
    > Followed by (note the missing /struct/)
    >
    > Employee emp = {.ID=0, .record=NULL};


    Works only with an appropriate typedef.


    > I guess my question really is - where can I find examples of /new/ c99
    > features, c/w readable descriptions?


    Not exactly what you are looking for, but a good starting
    point:
    http://david.tribble.com/text/cdiffs.htm

    > Just noticed that the article says that long long is at least 64 bits,
    > whereas the std says
    >
    > The rank of long long int shall be greater than the rank of long int,
    > which
    > shall be greater than the rank of int, which shall be greater than the
    > rank of short
    > int, which shall be greater than the rank of signed char.
    >
    > So, is there some error here too perhaps?


    No. Learn to read the standard carefully. long long's guaranteed
    maximum and minimum values are representable only if you use at least
    64 bits.


    Cheers
    Michael
    --
    E-Mail: Mine is an /at/ gmx /dot/ de address.
    Michael Mair, Feb 20, 2006
    #2
    1. Advertising

  3. Jordan Abel Guest

    On 2006-02-20, Michael Mair <> wrote:
    >> I guess my question really is - where can I find examples of /new/ c99
    >> features, c/w readable descriptions?

    >
    > Not exactly what you are looking for, but a good starting
    > point:
    > http://david.tribble.com/text/cdiffs.htm


    http://home.tiscalinet.ch/t_wolf/tw/c/c9x_changes.html is probably
    better for the purpose of the question. At a glance, though, the page
    you linked is a good analysis of the most recent chapter in the
    compatibility and lack thereof between C and C++, though.

    >> Just noticed that the article says that long long is at least 64 bits,
    >> whereas the std says
    >>
    >> The rank of long long int shall be greater than the rank of long int,
    >> which shall be greater than the rank of int, which shall be greater
    >> than the rank of short int, which shall be greater than the rank of
    >> signed char.


    Where does it say that? I'm confused by "rank", does that mean they
    can't all be the same width?

    >>
    >> So, is there some error here too perhaps?

    >
    > No. Learn to read the standard carefully. long long's guaranteed
    > maximum and minimum values are representable only if you use at least
    > 64 bits.


    There are, unfortunately, a _lot_ of things the standard says that it
    doesn't really come out and say. Long long int is required to represent
    the range from 2^63-1 to -2^63+1, inclusive. Unsigned long long int is
    required to represent the range from 1 to 2^64-1.
    Jordan Abel, Feb 20, 2006
    #3
  4. Michael Mair Guest

    Jordan Abel schrieb:
    > On 2006-02-20, Michael Mair <> wrote:
    >
    >>>I guess my question really is - where can I find examples of /new/ c99
    >>>features, c/w readable descriptions?

    >>
    >>Not exactly what you are looking for, but a good starting
    >>point:
    >> http://david.tribble.com/text/cdiffs.htm

    >
    > http://home.tiscalinet.ch/t_wolf/tw/c/c9x_changes.html is probably
    > better for the purpose of the question. At a glance, though, the page
    > you linked is a good analysis of the most recent chapter in the
    > compatibility and lack thereof between C and C++, though.


    Ah, will have a look at this page.
    BTW: David Tribble's page was a good first C99 introduction
    for me :)

    >>>Just noticed that the article says that long long is at least 64 bits,
    >>>whereas the std says
    >>>
    >>>The rank of long long int shall be greater than the rank of long int,
    >>>which shall be greater than the rank of int, which shall be greater
    >>>than the rank of short int, which shall be greater than the rank of
    >>>signed char.

    >
    > Where does it say that? I'm confused by "rank", does that mean they
    > can't all be the same width?


    No. This is the conversion rank. Whenever you have the same signedness
    and different conversion rank, the numbers representable by the
    integer type with lower rank also are within the range that can be
    represented by the integer type with higer rank.
    Have a look at 6.2.5 and 6.3.1.1 for a start.


    >>>So, is there some error here too perhaps?

    >>
    >>No. Learn to read the standard carefully. long long's guaranteed
    >>maximum and minimum values are representable only if you use at least
    >>64 bits.

    >
    > There are, unfortunately, a _lot_ of things the standard says that it
    > doesn't really come out and say. Long long int is required to represent
    > the range from 2^63-1 to -2^63+1, inclusive. Unsigned long long int is
    > required to represent the range from 1 to 2^64-1.

    (ITYM 0 to 2^64-1)

    This is true -- I regularly prove my misreading of the standard
    round here... However, as rank is defined in a relatively clear
    way (by the standard's standards ;-)), it should be clear that
    the range of long long is not restricted by the cited part.


    Cheers
    Michael
    --
    E-Mail: Mine is an /at/ gmx /dot/ de address.
    Michael Mair, Feb 20, 2006
    #4
  5. Guest

    Jordan Abel wrote:
    > On 2006-02-20, Michael Mair <> wrote:
    > >> I guess my question really is - where can I find examples of /new/ c99
    > >> features, c/w readable descriptions?

    > >
    > > Not exactly what you are looking for, but a good starting
    > > point:
    > > http://david.tribble.com/text/cdiffs.htm

    >
    > http://home.tiscalinet.ch/t_wolf/tw/c/c9x_changes.html is probably
    > better for the purpose of the question. At a glance, though, the page
    > you linked is a good analysis of the most recent chapter in the
    > compatibility and lack thereof between C and C++, though.
    >
    > >> Just noticed that the article says that long long is at least 64 bits,
    > >> whereas the std says
    > >>
    > >> The rank of long long int shall be greater than the rank of long int,
    > >> which shall be greater than the rank of int, which shall be greater
    > >> than the rank of short int, which shall be greater than the rank of
    > >> signed char.

    >
    > Where does it say that? I'm confused by "rank", does that mean they
    > can't all be the same width?
    >
    > >>
    > >> So, is there some error here too perhaps?

    > >
    > > No. Learn to read the standard carefully. long long's guaranteed
    > > maximum and minimum values are representable only if you use at least
    > > 64 bits.

    >
    > There are, unfortunately, a _lot_ of things the standard says that it
    > doesn't really come out and say. Long long int is required to represent
    > the range from 2^63-1 to -2^63+1, inclusive. Unsigned long long int is
    > required to represent the range from 1 to 2^64-1.


    Thanks for the info and the links.

    x

    Jo
    , Feb 21, 2006
    #5
    1. Advertising

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. Replies:
    3
    Views:
    3,671
    Chris Torek
    Feb 20, 2006
  2. c99 docs - any good?

    , Feb 20, 2006, in forum: C Programming
    Replies:
    2
    Views:
    274
  3. Replies:
    3
    Views:
    594
    Keith Thompson
    Mar 31, 2007
  4. KYG
    Replies:
    2
    Views:
    883
    Ian Collins
    Aug 18, 2008
  5. Stéphane Wirtel
    Replies:
    0
    Views:
    179
    Stéphane Wirtel
    Apr 19, 2007
Loading...

Share This Page