Re: Looking for a way to convert dec to bin



"J French" <erewhon@xxxxxxxxxx> wrote in message
news:45efd143.4001610@xxxxxxxxxxxxxxxxxxxxxxx
I'm very much against declaring variables anywhere other than at the
top of a block, I prefer to see at a glance what is going to be used.

I've done this for years simply because it has been the common convention
but I cannot see any benefit in it at all. I've completely gone away from
this in dot net and declare all variables with the minimum possible scope.
I'm not sure about vb.net but in C# you can delare a variable that has the
scope of just a for loop, or just the scope of an if statement or just the
scope of an else statement. eg: i is declared 4 times in this code and all
are seperate variables.


for(int i = 1; i < 10; i++)
{
Console.WriteLine(i.ToString());
}
for(int i = 1; i < 10; i++)
{
Console.WriteLine(i.ToString());
}
if(Environment.TickCount == 1)
{
int i = 5;
Console.WriteLine(i.ToString());
}
else
{
int i = 2;
Console.WriteLine(i.ToString());
}





.



Relevant Pages

  • Re: scope and linkage rule, very confusing!
    ... >> function scope ... >> int f{ ... Labels that can be the targets of a goto statement, ... > both linkage and storage duration. ...
    (comp.lang.c)
  • Re: Local variables - quick question
    ... You can't use a variable which isn't in scope within ... possiblity to declare class argument int i - only signal for me is compiler ... > being alive by the garbage collector. ...
    (microsoft.public.dotnet.languages.csharp)
  • scope, linkage and storage duration
    ... /* Scope, linkage and storage duration in C ... struct t3 y10; ...
    (comp.lang.c)
  • Re: Porting from visual C to gcc problem
    ... the compiler must have come across the typedef ... >>function declaration, ... then the scope lasts to through the body to ... >>int func; ...
    (comp.lang.c.moderated)
  • Re: In which scope should variables be declared?
    ... >specific scope I can. ... >int foo ... of this loop to the next, DON'T declare it inside the for loop. ... > In this case, if the declaration maps to any cpu time when compiled, ...
    (comp.lang.c)

Loading