Re: struct problems



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 ]
.



Relevant Pages

  • Re: Rene is a hypocrite (OK, what else is new?)
    ... I guess this means that Rene and his minions blew it again :-). ... > underscore can be used to make numbers appear more easy to read. ... misunderstanding of what programmers consider "good programming ... It is creating scope, ...
    (alt.lang.asm)
  • Re: Style: using functions/methods/procedures
    ... One guideline is to use a style call top-down programming. ... functions so you quickly move to the coding stage (almost a universal ... But in the end it is all about the assignment. ... (to have multiple routines would require ...
    (comp.programming)
  • Re: struct problems
    ... this distinction though some, helpfully, have more distinctive syntax. ... The only worlds in which it is an assignment are imaginary ones. ... call it initialise if you want. ... that you are ONLY in the scope of functions. ...
    (comp.lang.c)
  • Ruby violates hallowed Structured Programming sophistries
    ... Before Object Oriented Programming, ... control flow to variable scope. ... Structured Programmers decry the mighty goto keyword, ... I am unaware if Ruby supports goto. ...
    (comp.object)
  • Re: Graphing problem
    ... programming methodology" is not an exaggeration? ... All other poor styles of doing Windows programming methodology emulate Petzold. ... No declaration of this variable is shown. ... The scope and lifetime of a variable should be as narrow as possible. ...
    (microsoft.public.win32.programmer.gdi)