473,402 Members | 2,064 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

Name of the part after the declaration list in a block in C89

Hello,

in C89 (at least in the last public draft),
"3.6.2 Compound statement, or block", we have

,---
| Syntax
|
| compound-statement:
| { declaration-list<opt> statement-list<opt> }
|
| declaration-list:
| declaration
| declaration-list declaration
|
| statement-list:
| statement
| statement-list statement
`---

Now, we can call the first part/group (called declaration-list above)
"declarations" or "declaration list" etc.
My question: Is there an official or widely accepted name for the
second group (called statement list)? Ideally handy and descriptive;
"the optional group of statements after the optional declarations"
does not make me really happy...
If there is none, then I'd appreciate to know so, too.

Cheers
Michael
--
E-Mail: Mine is an /at/ gmx /dot/ de address.
Nov 15 '05 #1
9 1481
Michael Mair wrote:

Hello,

in C89 (at least in the last public draft),
"3.6.2 Compound statement, or block", we have

,---
| Syntax
|
| compound-statement:
| { declaration-list<opt> statement-list<opt> }
|
| declaration-list:
| declaration
| declaration-list declaration
|
| statement-list:
| statement
| statement-list statement
`---

Now, we can call the first part/group (called declaration-list above)
"declarations" or "declaration list" etc.
My question: Is there an official or widely accepted name for the
second group (called statement list)? Ideally handy and descriptive;
"the optional group of statements after the optional declarations"
does not make me really happy...
If there is none, then I'd appreciate to know so, too.


If you're comfortable calling the declarations "declarations",
then why not refer to the statements as "statements"?

Unlike declarations, you won't find statements
anywhere else in a program.
If you say statements, it's clear that you're talking
about a function definition.

--
pete
Nov 15 '05 #2
pete wrote:
Michael Mair wrote:
Hello,

in C89 (at least in the last public draft),
"3.6.2 Compound statement, or block", we have

,---
| Syntax
|
| compound-statement:
| { declaration-list<opt> statement-list<opt> }
|
| declaration-list:
| declaration
| declaration-list declaration
|
| statement-list:
| statement
| statement-list statement
`---

Now, we can call the first part/group (called declaration-list above)
"declarations" or "declaration list" etc.
My question: Is there an official or widely accepted name for the
second group (called statement list)? Ideally handy and descriptive;
"the optional group of statements after the optional declarations"
does not make me really happy...
If there is none, then I'd appreciate to know so, too.
If you're comfortable calling the declarations "declarations",
then why not refer to the statements as "statements"?

Unlike declarations, you won't find statements
anywhere else in a program.


You are right; unfortunately, the intended audience will probably
struggle with seeing declarations as "not statements".
I was not clear in my question; it should rather have the addition
"apart from statements/statement list"...
If you say statements, it's clear that you're talking
about a function definition.


Or a part thereof.

Thank you for your contribution!

-Michael
--
E-Mail: Mine is an /at/ gmx /dot/ de address.
Nov 15 '05 #3
Michael Mair wrote:
unfortunately, the intended audience will probably
struggle with seeing declarations as "not statements".


Declarations describe types.
Simple (meaning not compound) statements don't describe types.

The only thing that a compound statement is required to have,
is {} a pair of braces.
It may contain declarations followed by statements,
both are optional.

The only part of a compound statement that can describe types,
is it's declarations.

{
declarations;
/* blank line */
statements;
}

.... and that's how I write the body of a function definition in C89.
The declarations in a function definition can be any kind,
except a function definition.
What could be simpler?

I try to find broad generalizations in C.

When you look at a C program, you see four things
1 comments
2 preprocessor directives
3 external declarations
4 extra white space

.... not necessarily all distinct from each other,
and comments, directives, and extra white space are all optional,
but there's nothing else that can be in a program.

The function definition is probably the most important kind
of declaration.
It is the only declaration which doesn't end in a semicolon.
It is the only declaration which can't be inside a function definition.
It is the only declaration required to be in a program.

--
pete
Nov 15 '05 #4
pete wrote:
Michael Mair wrote:
unfortunately, the intended audience will probably
struggle with seeing declarations as "not statements".


Declarations describe types.
Simple (meaning not compound) statements don't describe types.


The problem in this case is, for a change, not my lack of
understanding of the standard but of another way of saying
"statement list<opt>".
Thinking about it once more, I fear this will lead into
off-topic regions.

The consuments of the description already have enough flavours
of "statements" which are similar to the C statement but
unfortunately can also include "declaration statements" and
worse. In other cases, I only have a simple disambiguation to
make ("foo block <-> C block") but in this case, I would like
something different yet descriptive to avoid complete bewilderment.

Reminds of beverages which are nearly but not completely unlike
tea...

<snip: nice list of facts about compound statements and things
found in C programs>

Cheers
Michael
--
E-Mail: Mine is an /at/ gmx /dot/ de address.
Nov 15 '05 #5
Michael Mair wrote:

pete wrote:
Michael Mair wrote:
unfortunately, the intended audience will probably
struggle with seeing declarations as "not statements".
Declarations describe types.
Simple (meaning not compound) statements don't describe types.


The problem in this case is, for a change, not my lack of
understanding of the standard but of another way of saying
"statement list<opt>".
Thinking about it once more, I fear this will lead into
off-topic regions.

The consuments of the description already have enough flavours
of "statements" which are similar to the C statement but
unfortunately can also include "declaration statements"


Could you tell them that C redefines some general programming terms?
It does.
Maybe you could prefix and redefine some general programming terms:
C statements, C strings, ... when discussing C.
In my Intel cpu manuals, a "string" is
something more like a C array, than a C string.
and worse. In other cases, I only have a simple disambiguation to
make ("foo block <-> C block") but in this case, I would like
something different yet descriptive to avoid complete bewilderment.

Reminds of beverages which are nearly but not completely unlike
tea...


Flavored coffee is enough to confuse my simple mind.

--
pete
Nov 15 '05 #6
Michael Mair <Mi**********@invalid.invalid> writes:
pete wrote:
Michael Mair wrote:
unfortunately, the intended audience will probably
struggle with seeing declarations as "not statements".

Declarations describe types.
Simple (meaning not compound) statements don't describe types.


The problem in this case is, for a change, not my lack of
understanding of the standard but of another way of saying
"statement list<opt>".
Thinking about it once more, I fear this will lead into
off-topic regions.

The consuments of the description already have enough flavours
of "statements" which are similar to the C statement but
unfortunately can also include "declaration statements" and
worse. In other cases, I only have a simple disambiguation to
make ("foo block <-> C block") but in this case, I would like
something different yet descriptive to avoid complete bewilderment.


Is there a reason that simply telling them

In C, statements and declarations are two different things;
declarations are not statements.

won't work?

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 15 '05 #7
Keith Thompson wrote:
Michael Mair <Mi**********@invalid.invalid> writes:
pete wrote:
Michael Mair wrote:
unfortunately, the intended audience will probably
struggle with seeing declarations as "not statements".

Declarations describe types.
Simple (meaning not compound) statements don't describe types.


The problem in this case is, for a change, not my lack of
understanding of the standard but of another way of saying
"statement list<opt>".
Thinking about it once more, I fear this will lead into
off-topic regions.

The consuments of the description already have enough flavours
of "statements" which are similar to the C statement but
unfortunately can also include "declaration statements" and
worse. In other cases, I only have a simple disambiguation to
make ("foo block <-> C block") but in this case, I would like
something different yet descriptive to avoid complete bewilderment.

Is there a reason that simply telling them

In C, statements and declarations are two different things;
declarations are not statements.

won't work?


Well, probably not a sufficient one from a C point of view.
I just hoped to find an alternative way of saying
"statement-list" just like I can use "block" instead of
"compound statement". Even something sufficiently close would
have sufficed.

However, I think I will try statement list once more...
Thanks
Michael
--
E-Mail: Mine is an /at/ gmx /dot/ de address.
Nov 15 '05 #8
Michael Mair <Mi**********@invalid.invalid> writes:
pete wrote:
Michael Mair wrote:
Hello,

in C89 (at least in the last public draft),
"3.6.2 Compound statement, or block", we have

,---
| Syntax
|
| compound-statement:
| { declaration-list<opt> statement-list<opt> }
|
| declaration-list:
| declaration
| declaration-list declaration
|
| statement-list:
| statement
| statement-list statement
`---

Now, we can call the first part/group (called declaration-list above)
"declarations" or "declaration list" etc.
My question: Is there an official or widely accepted name for the
second group (called statement list)? Ideally handy and descriptive;
"the optional group of statements after the optional declarations"
does not make me really happy...
If there is none, then I'd appreciate to know so, too.


If you're comfortable calling the declarations "declarations",
then why not refer to the statements as "statements"?

Unlike declarations, you won't find statements
anywhere else in a program.


You are right; unfortunately, the intended audience will probably
struggle with seeing declarations as "not statements".
I was not clear in my question; it should rather have the addition
"apart from statements/statement list"...


If it were me, I'd consider calling them "executable statements", and
immediately put in a minor digression (or a footnote, if writing) and
say something like

The official defining document for C calls these just
"statements" rather than "executable statements", and
uses the term "declaration" for things like 'int i;'.
So technically we're using the wrong terminology; but
I think everyone knows what I mean if I say "executable
statement" so we're going to keep using that.

If you're doing a talk, be ready for the inevitable person
who asks about whether 'double x_squared = x * x;' is an
executable statement or not. :)
Nov 15 '05 #9
Tim Rentsch wrote:
Michael Mair <Mi**********@invalid.invalid> writes:

pete wrote:
Michael Mair wrote:
Hello,

in C89 (at least in the last public draft),
"3.6.2 Compound statement, or block", we have

,---
| Syntax
|
| compound-statement:
| { declaration-list<opt> statement-list<opt> }
|
| declaration-list:
| declaration
| declaration-list declaration
|
| statement-list:
| statement
| statement-list statement
`---

Now, we can call the first part/group (called declaration-list above)
"declarations" or "declaration list" etc.
My question: Is there an official or widely accepted name for the
second group (called statement list)? Ideally handy and descriptive;
"the optional group of statements after the optional declarations"
does not make me really happy...
If there is none, then I'd appreciate to know so, too.

If you're comfortable calling the declarations "declarations",
then why not refer to the statements as "statements"?

Unlike declarations, you won't find statements
anywhere else in a program.
You are right; unfortunately, the intended audience will probably
struggle with seeing declarations as "not statements".
I was not clear in my question; it should rather have the addition
"apart from statements/statement list"...

If it were me, I'd consider calling them "executable statements", and
immediately put in a minor digression (or a footnote, if writing) and
say something like

The official defining document for C calls these just
"statements" rather than "executable statements", and
uses the term "declaration" for things like 'int i;'.
So technically we're using the wrong terminology; but
I think everyone knows what I mean if I say "executable
statement" so we're going to keep using that.


This may be a viable way :-)
If you're doing a talk, be ready for the inevitable person
who asks about whether 'double x_squared = x * x;' is an
executable statement or not. :)


*g* I already fell into that one yesterday, when I was first
asked how to call that part of a block... Initializers surely
make life hard in this respect ;-)

Thank you very much :-)
Michael
--
E-Mail: Mine is an /at/ gmx /dot/ de address.
Nov 15 '05 #10

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

Similar topics

7
by: YGeek | last post by:
Is there any difference between declaring a variable at the top of a method versus in the code of the method? Is there a performance impact for either choice? What about if the method will return...
19
by: White Wolf | last post by:
Hi, I cannot believe my eyes, but so far I could not find out what is the name of the construct, which is built from one try block and the catch clauses (handlers). I am not looking for a...
2
by: JJA | last post by:
Please advise on how to get the GROUP BY coded in an acceptable way: DECLARE @LO INT DECLARE @HI INT DECLARE @StartDate varchar(10) DECLARE @EndDate varchar(10) SELECT @StartDate =...
17
by: Joe Laughlin | last post by:
I've not used C much before, so I don't know how robust or good this code is. I'd appreciate any feedback or criticisms anyone has! Thanks, Joe #include <stdio.h> #include <string.h>
16
by: Vadim Biktashev | last post by:
Hello all I would like to give a certain name to a certain global variable. Unfortunately, this name is already used in math.h for a mathematical function. Worse, I do need to use maths library...
13
by: amykimber | last post by:
Hi all, I know I'm doign something really daft, but I can't get this to work... I have a form with a bunch of inputs called ship_owner - why the ? Because I'm submitting this page though php...
18
by: sunny | last post by:
Hi Why does C allows declaration of variable inside switch block. ex: foll prg does not gives "undeclared "b" error msg. but also does not initialize b to 20 int a=1; switch(a) { int b=20;...
6
by: sandy | last post by:
I am creating a class (or so I hope) which is to be a JobCollection, linked list of 'Job'. Job is another class already created. JobCollection is just the linked list manager. I have to have...
1
KevinADC
by: KevinADC | last post by:
Introduction In part one we discussed the default sort function. In part two we will discuss more advanced techniques you can use to sort data. Some of the techniques might introduce unfamiliar...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.