Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > c99 docs - any good?

Reply
Thread Tools

c99 docs - any good?

 
 
mechanicfem@googlemail.com
Guest
Posts: n/a
 
      02-20-2006
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/conte...lus&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?

 
Reply With Quote
 
 
 
 
Michael Mair
Guest
Posts: n/a
 
      02-20-2006
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/conte...lus&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.
 
Reply With Quote
 
 
 
 
Jordan Abel
Guest
Posts: n/a
 
      02-20-2006
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.
 
Reply With Quote
 
Michael Mair
Guest
Posts: n/a
 
      02-20-2006
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.
 
Reply With Quote
 
mechanicfem@googlemail.com
Guest
Posts: n/a
 
      02-21-2006

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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Difference between "library parts" of C99 and "language parts" of C99 albert.neu@gmail.com C Programming 3 03-31-2007 08:14 PM
501 PIX "deny any any" "allow any any" Any Anybody? Networking Student Cisco 4 11-16-2006 10:40 PM
Do Printed Word Docs Look Any Differently From PDF Docs? Martin Computer Support 5 09-20-2006 11:06 PM
c99 docs - any good? mechanicfem@googlemail.com C Programming 2 02-20-2006 06:29 PM
C99 struct initialization (C99/gcc) jilerner@yahoo.com C Programming 3 02-20-2006 04:41 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57