fir
2024-08-20 16:48:17 UTC
got some thought today thet simply probably allowing
to define "int a" everywhere could be just simply a good
c (or other language) design decision
there are here places when its not allowed like
if(int a==2) {} or
foo(1,2,int a); or f= a*int b*c
and soem must write
int a;
if(a==2) {} or
int a;
foo(1,2,a);
int b;
f= a*b*c
but is probably pointles to disallow that it simply
probably should be allowed..
some could say that local variables need initialisation
but no problem to also write initialisation imo
if((int a=2)==2)
it may look weird but this ewirdness is side thing
(not part of this idea) and the idea is imo most probably
right
to define "int a" everywhere could be just simply a good
c (or other language) design decision
there are here places when its not allowed like
if(int a==2) {} or
foo(1,2,int a); or f= a*int b*c
and soem must write
int a;
if(a==2) {} or
int a;
foo(1,2,a);
int b;
f= a*b*c
but is probably pointles to disallow that it simply
probably should be allowed..
some could say that local variables need initialisation
but no problem to also write initialisation imo
if((int a=2)==2)
it may look weird but this ewirdness is side thing
(not part of this idea) and the idea is imo most probably
right