• Forum
  • Lounge
  • Ever look at old code and think? What th

 
Ever look at old code and think? What the hell was I smoking?

Pages: 123... 5
I can't remember which file it was in so I could give the example, but last night I found an old folder with loads of unfinished projects of mine from highschool. Six nested loops anyone?
I look at old code and remember "Oh yeah, I didn't know how to do X so I did this workaround instead". People tell me they can't understand their old code, but I can still understand my old code from 3+ years ago.
closed account (EwCjE3v7)
I can understand my old code, but what I always say to myself "Hahah, how stupid was I. Why would I write 50 lines of code when I can do that liek in 5"

And I remember that I was smoking weed to :)
Last edited on
That makes me think of a file I did back in '96 (that I actually keep on all my hard drives to remind how much of idiot I was starting out) when I started doing C++ for DUMMIES (how I miss Rhide sometimes). It is one of the things I refer back to in order to keep me from getting a big head and to try and not get short with beginners. It is the proof that some experiments should stay thoughts and not be implemented.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include <iostream.h>

void main()
{
	for(int i = 0; i < 10; ++i)
	{
		cout << i;
		for(int j = 10; j < 20; ++j)
		{
			cout << j;
			for(int k = 20; k < 30; ++k)
			{
				cout << k;
				for(int l = 30; l < 40; ++l)
				{
					cout << l;
					for(int m = 40; m < 50; ++m)
					{
						cout << m;
						for(int n = 50; n < 60; ++n)
						{
							cout << n;
							for(int o = 60; o < 70; ++o)
							{
								cout << o;
								for(int p = 70; p < 80; ++p)
								{
									cout << p;
									for(int q = 80; q < 90; ++q)
									{
										cout << q;
										for(int r = 90; r <= 100;++r)
										{
											cout << r;
										}
										cout << endl;
									}
									cout << endl;
								}
								cout << endl;
							}
							cout << endl;
						}
						cout << endl;
					}
					cout << endl;
				}
				cout << endl;
			}
			cout << endl;
		}
		cout << endl;
	}
	cout << endl;
}
And I remember that I was smoking weed to


Aren't you like 12?
According to his profile he is 3 years younger then me (so 29 almost 30).
On that note, Don't smoke pot and code. Smoke pot and listen to music, have an epiphany of how to micro optimize that one algorithm, write
it down, sober up and THEN code.
Last edited on
Also, captain blast, don't smoke pot in your adolescence. And when you're brain has stopped developing, do it in moderation.
@bhx When he was "captain blast" he said he was 12 and the birth date used to say 2002 he must have changed it recently.
Last edited on
There's actually studies suggesting that the brain stops developing much later in life than first thought.

@BHX: Did the for-dummies book tell you to use iostream.h? Do you remember what source of information you got that from?
@bhx: what was your goal with that code?

Don't smoke pot and code
it is however perfectly acceptable to drink alchohol and code (xkcd <3)

Also, captain blast, don't smoke pot in your adolescence. And when you're brain has stopped developing, do it in moderation.
not that i care to smoke pot, why is it bad to smoke before your brain stops developing?
LB wrote:

@BHX: Did the for-dummies book tell you to use iostream.h? Do you remember what source of information you got that from?

Back in '96 compilers required .h, void main was perfectly legal, and std:: wasn't required. I don't think it was changed until the 98 or 03 standard.

Little Bobby Tables wrote:
@bhx: what was your goal with that code?

Back then it was just being silly and trying to understand for loops.
Last edited on
Ah, I didn't realize the code was that old! Sorry.
I recently looked at my first OO program in python. Instead of looping for the lenght of lists I used magic numbers. I couldn't believe I worte that.
"why is it bad to smoke before your brain stops developing?"

The majority of the studies I've read that have shown negative side effects from smoking pot have shown them in participants who are adolescents. The rest were ill defined or funded by lobbysts against pot.
closed account (N36fSL3A)
I thought I was a C++ guru and wrote bad code and thought I was 1337, I know this isn't exactly healthy, but I feel like inventing a time machine just to punch my younger self in the face. I used to use macros and raw pointers directly without any sort of pool allocator, and use the graphics API directly without any sort of abstraction layer. Now that I've seen what I've done wrong, I've almost completely changed my coding style. (I also used to use SDL 1.2 blindly and claim it's the best lib ever. I'd much rather use 2.x)

My younger self is the type of person that I seriously despise, lol.
_________________________

Why does everyone think it's cool to smoke pot? Your mother isn't going to be very happy when she finds out that her flower pots burned. Not worth the grounding. Lol.
Last edited on
Back in '96 compilers required .h, void main was perfectly legal, and std:: wasn't required. I don't think it was changed until the 98 or 03 standard.


void main has never been legal in either C or C++.

http://www.stroustrup.com/bs_faq2.html#void-main
@cire
Thanks for pointing that out. C++ for DUMMIES back then said it was legal, but was frowned upon due to not returning anything to the system. When I joined Allegro, most of the games I looked at the source to was using void main, but never heard it was bad. Guess the only dummy was me for believing the book without question.
As far as I understand it, the original stating of C99 actually had poor wording when it came to the declaration of program entry. It claimed that it required a type of int but that other types would be implementation defined.

Unfortunately, I've found it impossible to find a draft of the C99 standard that doesn't have the various revisions applied to it so I can't be sure.

In the C89 ANSI standard, it doesn't mention return type at all. It just says "The function called at program startup is named main". It provides an example of what the function may look like but no written definition of what it's supposed to be otherwise.
Last edited on
The void main dispute is because many compilers for small microcomputers actually do require you to use void main since there is no operating system to return to. This is the "implementation defined" clause of the C standard - unfortunately C++ completely forbids it is difficult for there to be C++ compilers for these small microcomputers. I have worked with such compilers and such microcomputers.
Pages: 123... 5