Re: struct problems
- From: nick_keighley_nospam@xxxxxxxxxxx
- Date: Wed, 21 Jan 2009 05:51:51 -0800 (PST)
On 20 Jan, 16:00, Richard <rgrd...@xxxxxxxxx> wrote:
Ben Bacarisse <ben.use...@xxxxxxxxx> writes:
Richard <rgrd...@xxxxxxxxx> writes:
<snip about int x = 1; at file scope>
"Assign 1 the global here". The assigment symbol "=" is the giveaway
that not everyone speaks "standard".
It has nothing to do with "speaking standard". You can't program in C
without knowing the difference. There are huge differences between
I have done for years. Well, understanding what people mean and not
being anal about it.
what can be done in an assignment and what is permitted in an
initialisation. It is not even limited to C. Lots of languages have
this distinction though some, helpfully, have more distinctive syntax.
While these exatra distinctions help, the issue is hardly obscure in C
-- you very soon learn the syntactic difference between a statement
and a declaration.
for instance even when learning C I wouldn't have written
int i;
i = 1;
int main(void)
{
<whatever>
}
because my previous programming experience made the assignment before
main() to just look "wrong"
Many professional programmers never, ever learn the CORRECT terminology
true. But experience C programmers know that they can "assign" a value
to the variable in the declaration whilst they can't "assign" to in
outside a function but not in a declaration.
I submit this becomes easier to understand if you *do*
distinguish initialisation from assignment (it becomes
even more important in C++).
since its, well, not required to be a good programmer.
I think it helps. Though one of my collegues has learnt
at least three programming languages by copy-pasteing.
One knows what
one means. I dont expect many people to agree with me.
oh, you'll find peopel who'll agree with you. I'm just
not one of them.
<snip>
You seem to miss the point.
int b = 1;
It IS common vocabulary to say "Assign 1 to b".
Hence my reply about choosing language carefully when talking to people
like Bill.
"carefully" to me means using the correct (standardese) definitions.
He might even understand *why* he can't do what he was trying to do!
It made it sound like you could not initialise a variable outside a
function. The fact is you can. The FACT is that (in my experience) MOST
people would still say we "assign 1 to b" in this case.
Clearly one can not assign a recently modified variable to b later on
outside the scope of a function since the execution path does not allow
that you are ONLY in the scope of functions.
We won't agree. Call me unprofessional, dense, etc etc if you want. But
I know what someone means when they say "assign 1 to be" in the
global/module scope. I dont feign confusion.
ok, nor me. But I might correct them. And I would probably
explain the difference between initialisation and assignment
if they put code like Bill's in front of me.
Some quite smart people wrote the standard, why not use it?
--
Nick Keighley
We recommend, rather, that users take advantage of the extensions of
GNU C and disregard the limitations of other compilers. Aside from
certain supercomputers and obsolete small machines, there is less
and less reason ever to use any other C compiler other than for
bootstrapping GNU CC.
(Using and Porting GNU CC)
[last time I posted that I was subject to hail of brickbats.
Just because it's in my sig doesn't mean I agree with it ]
.
- References:
- struct problems
- From: Bill Cunningham
- Re: struct problems
- From: Richard Tobin
- Re: struct problems
- From: Bill Cunningham
- Re: struct problems
- From: Keith Thompson
- Re: struct problems
- From: Richard
- Re: struct problems
- From: nick_keighley_nospam
- Re: struct problems
- From: nick_keighley_nospam
- Re: struct problems
- From: Ben Bacarisse
- Re: struct problems
- From: Richard
- Re: struct problems
- From: nick_keighley_nospam
- Re: struct problems
- From: Richard
- Re: struct problems
- From: Ben Bacarisse
- Re: struct problems
- From: Richard
- struct problems
- Prev by Date: Re: When it will be freed?
- Next by Date: Re: struct problems
- Previous by thread: Re: struct problems
- Next by thread: Re: struct problems
- Index(es):
Relevant Pages
|