473,657 Members | 2,486 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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)
"declaratio ns" or "declaratio n 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 1499
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)
"declaratio ns" or "declaratio n 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 "declaratio ns",
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 "declaratio n 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 "declaratio ns",
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 "declaratio n 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 "declaratio n 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**********@i nvalid.invalid> writes:
pete wrote:
Michael Mair wrote:
unfortunatel y, 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 "declaratio n 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_Keit h) 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**********@i nvalid.invalid> writes:
pete wrote:
Michael Mair wrote:
unfortunate ly, the intended audience will probably
struggle with seeing declarations as "not statements".

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


The problem in this case is, for a change, not my lack of
understandi ng 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
unfortunate ly can also include "declaratio n 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**********@i nvalid.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 "declaratio n 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 "declaratio ns",
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 "declaratio n" 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**********@i nvalid.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)
"declaratio ns" or "declaratio n 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 "declaratio ns",
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 "declaratio n" 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
2661
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 before the variable is used? I'm trying to get an idea of whether the .NET compilers for VB.NET and C# will move all variable declaration to the beginning of a method or whether they will allocate the memory as it is needed by the method to...
19
2561
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 grammar name, but something people can remember, like handler. But is not handler, because those are the catch clauses and the try does not belong there. I have looked at all my books and the standard, but I could not find a name. :-( Is there...
2
5982
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 = '01/01/2005' SELECT @EndDate = '06/30/2005' SELECT @LO = 250
17
2313
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
3585
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 and therefore have to include math.h. Thus my compiler reports conflicting declarations of the same name. Does anyone know any reasonably elegant way to resolve this conflict? I understand that I can give up and choose another name, but somehow not...
13
3017
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 and the put the data into an array in the post.... anywhat. I have a link <a href="javascript:change_class()" >Block mode</a> to
18
2117
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; case 1: printf("b is %d\n",b);
6
5769
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 this separated into a .h and .cpp file. The code I am attempting to put into the class is code that I have used before, but simply put into the same file/class with the rest of the application. My header looks like this: <code>
1
7183
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 methods or syntax to a less experienced perl coder. I will post links to online resources you can read if necessary. Experienced perl coders might find nothing new or useful contained in this article. Short Review In part one I showed you some...
0
8392
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
8726
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
8503
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,...
0
8603
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5632
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
4151
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
4301
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1944
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.