Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > The order of block declaration

Reply
Thread Tools

The order of block declaration

 
 
Bill Leary
Guest
Posts: n/a
 
      02-11-2008
"Keith Thompson" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> "Bill Leary" <(E-Mail Removed)> writes:
>> The line
>> int dummy = printf("Hello, world\n");
>>
>> (and it's like) I've been interpreting as
>>
>> int dummy;
>> printf("Hello, world\n");
>>
>> for all these years. That is, I always saw it as a short hand form of
>> a declaration and code.

>
> Actually, it's equivalent to:
>
> int dummy;
> dummy = printf("Hello, world\n");


Thanks. That's what I meant. I've never been any damn good at proof
reading my own writing.

> The question is what the word "code" means. I see no reason to limit
> it to C statements. The real point is that, since there seems to be
> no consensus on what the word "code" really means, it's better to use
> an unambiguous term. If you want to talk about statements, call them
> "statements".


I'll buy that. When I first wrote the above, I actually typed "...short
hand form of a declaration and a statement." then changed it to "code" to
conform with what I thought folks were using here. I think my first impulse
there was the more correct one.

- Bill

 
Reply With Quote
 
 
 
 
CJ
Guest
Posts: n/a
 
      02-11-2008
On Feb 11, 9:04 am, "Bill Leary" <(E-Mail Removed)> wrote:
> "Keith Thompson" <(E-Mail Removed)> wrote in message
>
> news:(E-Mail Removed)...
>
>
>
> > "Bill Leary" <(E-Mail Removed)> writes:
> >> The line
> >> int dummy = printf("Hello, world\n");

>
> >> (and it's like) I've been interpreting as

>
> >> int dummy;
> >> printf("Hello, world\n");

>
> >> for all these years. That is, I always saw it as a short hand form of
> >> a declaration and code.

>
> > Actually, it's equivalent to:

>
> > int dummy;
> > dummy = printf("Hello, world\n");

>
> Thanks. That's what I meant. I've never been any damn good at proof
> reading my own writing.
>
> > The question is what the word "code" means. I see no reason to limit
> > it to C statements. The real point is that, since there seems to be
> > no consensus on what the word "code" really means, it's better to use
> > an unambiguous term. If you want to talk about statements, call them
> > "statements".

>
> I'll buy that. When I first wrote the above, I actually typed "...short
> hand form of a declaration and a statement." then changed it to "code" to
> conform with what I thought folks were using here. I think my first impulse
> there was the more correct one.
>
> - Bill


I have to agree, the declaration is "int dummy" and the code is
"printf("Hello, world\n");". But, we deal in syntax, not semantics.

I guess this yet another example of "six of one, half a dozen of
another."
cj
 
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
Fo:Block can you check to see if a block contains any text by using the block id? morrell XML 1 10-10-2006 07:18 PM
maxplusII error: a deferred constant declaration without a full declaration is not supported Noah VHDL 5 04-07-2006 02:34 PM
Function declaration in class declaration Ovidesvideo C++ 4 12-10-2004 06:36 PM
Intel C++ 8.0 : declaration hides declaration Alex Vinokur C++ 4 04-05-2004 09:49 PM



Advertisments