Valhalla Legends Forums Archive | General Programming | Programming style and evolution

AuthorMessageTime
Adron
[quote author=Mephisto link=board=30;threadid=6430;start=0#msg56384 date=1082683863]
I'm not trying to discourage you from learning C, but I just have to say your style is awful. If you're going to declare a list of variables of the same type either put them into an array or declare them in one statement using the comma (,) operator.
[/quote]

It is considered good style to declare no more than one variable per line, and to put a comment on that line describing what the variable will be used for.

April 23, 2004, 2:48 PM
iago
[quote author=Adron link=board=30;threadid=6430;start=15#msg56442 date=1082731700]
[quote author=Mephisto link=board=30;threadid=6430;start=0#msg56384 date=1082683863]
I'm not trying to discourage you from learning C, but I just have to say your style is awful. If you're going to declare a list of variables of the same type either put them into an array or declare them in one statement using the comma (,) operator.
[/quote]

It is considered good style to declare no more than one variable per line, and to put a comment on that line describing what the variable will be used for.


[/quote]

hmm, is the comma actually an operator here? I know it's an operator when you do "a = 2, 3", but I don't think "int a, b" is considered the "comma operator".
April 23, 2004, 4:04 PM
Eibro
[quote author=iago link=board=30;threadid=6430;start=15#msg56453 date=1082736286]
[quote author=Adron link=board=30;threadid=6430;start=15#msg56442 date=1082731700]
[quote author=Mephisto link=board=30;threadid=6430;start=0#msg56384 date=1082683863]
I'm not trying to discourage you from learning C, but I just have to say your style is awful. If you're going to declare a list of variables of the same type either put them into an array or declare them in one statement using the comma (,) operator.
[/quote]

It is considered good style to declare no more than one variable per line, and to put a comment on that line describing what the variable will be used for.


[/quote]

hmm, is the comma actually an operator here? I know it's an operator when you do "a = 2, 3", but I don't think "int a, b" is considered the "comma operator".
[/quote]No, you're right, it's not an operator when used in this context.
April 23, 2004, 6:38 PM
Adron
Btw, I don't like my old code at all. It's ugly.
April 23, 2004, 11:08 PM
iago
[quote author=Adron link=board=30;threadid=6430;start=15#msg56514 date=1082761735]
Btw, I don't like my old code at all. It's ugly.
[/quote]

Same. I'm embarassed with code I wrote a year ago :)
April 24, 2004, 12:48 AM
Mitosis
[quote author=iago link=board=30;threadid=6430;start=15#msg56523 date=1082767732]
[quote author=Adron link=board=30;threadid=6430;start=15#msg56514 date=1082761735]
Btw, I don't like my old code at all. It's ugly.
[/quote]

Same. I'm embarassed with code I wrote a year ago :)
[/quote]

Im ashamed of my code because of people like Joker :\
April 24, 2004, 1:05 AM
iago
[quote author=Mitosis link=board=5;threadid=6452;start=0#msg56528 date=1082768705]
[quote author=iago link=board=30;threadid=6430;start=15#msg56523 date=1082767732]
[quote author=Adron link=board=30;threadid=6430;start=15#msg56514 date=1082761735]
Btw, I don't like my old code at all. It's ugly.
[/quote]

Same. I'm embarassed with code I wrote a year ago :)
[/quote]

Im ashamed of my code because of people like Joker :\
[/quote]

I'm not sure what j0k3r said about your code, besides trying to give you advice about his mistakes.

The bottom line that I tell everybody I know who's learning programming:

We (that is, everybody in the world but Skywing, I think) aren't born with keyboards. It takes time and patience.
April 24, 2004, 6:55 PM
Etheran
a,b,c = 5,9,7

that's my idea of programming style :D
April 24, 2004, 8:32 PM
Yoni
[quote author=Etheran link=board=5;threadid=6452;start=0#msg56645 date=1082838773]
a,b,c = 5,9,7

that's my idea of programming style :D
[/quote]python whore
April 24, 2004, 8:35 PM
St0rm.iD
You are jealous of our eleet syntax constructs that let us write code in 1/10 the time it takes you.

Before you whine about performance, http://psyco.sf.net
April 24, 2004, 8:39 PM
Yoni
Yeah, I am. I started to learn Python (hence the fact I recognized that's what Etheran wrote his line of code in) but stopped due to lack of time (I'll check again in July or so).
April 24, 2004, 8:46 PM
iago
hmm

[code]int a, b, c;

a = b = c = 3, 2, 1;[/code]

Correct me if I'm wrong, but that's valid c, isn't it? Valid, yet horrible..

<edit>
My bad, this is what I was thinking of:

[code]int a, b, c;
a = (b = (c = 3, 2), 1);[/code]

stupid brackets :)


April 24, 2004, 8:51 PM
St0rm.iD
Yoni, you need any help, I'm pretty durned good :)
April 24, 2004, 9:16 PM
Yoni
[quote author=iago link=board=5;threadid=6452;start=0#msg56654 date=1082839909]
[code]int a, b, c;
a = (b = (c = 3, 2), 1);[/code]
[/quote]
That's pretty nice, never thought of that.

It's pretty confusing and useless, just like good hackerish code in C should be.
April 24, 2004, 10:01 PM

Search