473,769 Members | 7,756 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

c99 docs - any good?

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?

Feb 20 '06 #1
4 1522
me*********@goo glemail.com 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.
Feb 20 '06 #2
On 2006-02-20, Michael Mair <Mi**********@i nvalid.invalid> 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.
Feb 20 '06 #3
Jordan Abel schrieb:
On 2006-02-20, Michael Mair <Mi**********@i nvalid.invalid> 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.
Feb 20 '06 #4

Jordan Abel wrote:
On 2006-02-20, Michael Mair <Mi**********@i nvalid.invalid> 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 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
1569
by: Paul Rubin | last post by:
Has anyone got a script to convert the Python docs (particularly the library reference) to Info format, so they can be browsed with the Emacs Info browser? That would be much more convenient than having to fire up a web browser all the time. Thanks.
21
2076
by: Steven Bethard | last post by:
Can someone point me to the documentation on what's supposed to happen when you use the "for x in X:" syntax when X does not have an __iter__ method? I know that the code: >>> class S: .... def __len__(self): return 42 .... def __getitem__(self, i): return i .... >>> for x in S(): .... print x
7
2033
by: Brad Clements | last post by:
Is anyone interested in purchasing a hardcopy version of the Python 2.4 Library reference? That is, assuming it was NOT a direct print of current html/pdf versions. So, nicely formatted for a printed book (spiral bound probably), with several indexes as appropriate, or perhaps a permutted index. I'm thinking about doing this through lulu.com or cafepress, but it's going to take a lot of work to make a really nice printed version of...
40
2987
by: Xah Lee | last post by:
is it possible in Python to create a function that maintains a variable value? something like this: globe=0; def myFun(): globe=globe+1 return globe
0
2012
by: Jim Bancroft | last post by:
Hi folks, I'm interested in merging two xml docs together. The documents use the same structure, and in the case of similar nodes I'd like to keep the "newer" one. I'll explain what I mean by that below. For instance, if I have two docs like so: <!--xmldoc1-->
1
1743
by: Andy Britcliffe | last post by:
Hi I'm faced with the situation where I could have a single physical file that could contain multiplie XML documents e.g file.txt contains the following: <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE doc SYSTEM "1.0b.dtd"> <doc transmission-date="20050715T154340Z" >
14
2298
by: rurpy | last post by:
Another Python docs problem... I was trying to use imp.find_module(). >>> imp.find_module("mymod", "./subdir") ImportError: No frozen submodule named ./subdir.mymod subdir/mymod.py definately exists, has reasonable permissions, etc.
4
2171
by: Michael | last post by:
Hi! (OK, slightly silly subject line :) I'm extremely pleased to say - Kamaelia 0.4.0 has been released! What's New & Changed? =====================
5
2727
by: Chris | last post by:
I have a meetings section I'm developing on our intranet. Using PHP/MySQL. Meeting info and Meeting docs reside on 2 related tables in the db. Users may want to upload anywhere from 1 to 10 or more documents to share/use during a meeting presentation. What would be the most efficient way to approach this? This is the logic I'm currently considering: Page 1: Meeting Information input with link to a document upload page (this page...
12
1870
by: Alan Isaac | last post by:
This discussion ended abruptly, and I'd like to see it reach a conclusion. I will attempt to synthesize Bill and Carsten's proposals. There are two proposed patches. The first is to http://docs.python.org/lib/typesmapping.html where it is proposed for footnote (3) to state: Keys and values are listed in an arbitrary order. This order is indeterminate and generally depends on factors outside the scope
0
9579
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10197
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10032
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9977
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7391
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6661
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5293
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5432
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2810
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.