Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Proper way Variable declaration

Reply
Thread Tools

Proper way Variable declaration

 
 
Keith Thompson
Guest
Posts: n/a
 
      03-07-2008
CBFalconer <(E-Mail Removed)> writes:
> Nick Keighley wrote:
>> CBFalconer <(E-Mail Removed)> wrote:
>>> Keith Thompson wrote:
>>>
>>> ... snip ...
>>>
>>>> But if the reordering makes your code less clear, it's almost
>>>> certainly not worth it. Compilers aren't required to allocate
>>>> declared variables in the order of declaration anyway, so your
>>>> compiler might do this optimization for you. And the space
>>>> you'll save is likely to be minimal.
>>>
>>> However, within structures they have to be allocated in order.

>>
>> he said that in the bit you snipped. You keep on doing this...

>
> Thus proving that it was not immediately obvious in that message,
> and that my added comment was worth while, not useless.


How was it not obvious? The last paragraph of my message began with:

| A case where this kind of ordering *can* make a difference is in a
| struct declaration. Struct members, unlike standalone variables, are
| required to be allocated in the order in which they're declared.

That's unclear only if you don't bother to read it.

--
Keith Thompson (The_Other_Keith) <(E-Mail Removed)>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
 
Reply With Quote
 
 
 
 
CBFalconer
Guest
Posts: n/a
 
      03-07-2008
Keith Thompson wrote:
> CBFalconer <(E-Mail Removed)> writes:
>> Nick Keighley wrote:
>>

.... snip ...
>>
>>> he said that in the bit you snipped. You keep on doing this...

>>
>> Thus proving that it was not immediately obvious in that message,
>> and that my added comment was worth while, not useless.

>
> How was it not obvious? The last paragraph of my message began with:
>
>| A case where this kind of ordering *can* make a difference is in a
>| struct declaration. Struct members, unlike standalone variables, are
>| required to be allocated in the order in which they're declared.
>
> That's unclear only if you don't bother to read it.


I went back and looked. That final 'requote' was the last
paragraph in a roughly 80 line message. That alone makes it easy
to overlook. Alright, for me to overlook. No need to war about
it.

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.



--
Posted via a free Usenet account from http://www.teranews.com

 
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
proper declaration for template link problem Jeff Kish C++ 2 10-03-2006 07:15 PM
maxplusII error: a deferred constant declaration without a full declaration is not supported Noah VHDL 5 04-07-2006 02:34 PM
Variable declaration taken as a function pointer declaration Bolin C++ 4 12-02-2005 05:28 PM
variable definiton / variable declaration baumann@pan C Programming 3 05-11-2005 01:01 PM
Intel C++ 8.0 : declaration hides declaration Alex Vinokur C++ 4 04-05-2004 09:49 PM



Advertisments