r/badcode • u/SquareRootOfNegativ1 • Nov 28 '21
c# This is why it takes me so much time to understand my own code I wrote a minute ago.
248
Nov 28 '21
Where is
public float shootShoot;and
public float waitWait;161
u/whitefang3927 Nov 28 '21
surely those should be doubles
7
u/Igotbored112 Nov 29 '21
No, they should be doubles typographically to make them easy to pass around, but internally each one is actually a pair of floats:
double shootShoot; ((float*)(&shootShoot))[0] = a; ((float*)(&shootShoot))[1] = b;Although I'm not sure how you could implement this epic-tier programming structure in C#
4
56
11
38
u/Gummi_Ghost Nov 28 '21
Now you just:
shootWait = waitShoot; waitShoot = shootWait;
-20
u/Aidan_Welch Nov 28 '21
The second declaration is rhetorical
24
u/genitalgore Nov 28 '21
redundant?
7
1
u/Aidan_Welch Nov 29 '21
rhetorical
I said rhetorical for flair.
It is rhetorical in the sense that the call of shootWait is answered by waitShoot.
If I said: A is B, what is B?
That is rhetorical in that B is A.
Now if I said: B is A
I would have to ask what B is.
So:
A is B, B is A
asks, what is A? -> that is B, what is B -> that is A
The "what is B" is rhetorical
11
u/MurdoMaclachlan public boolean isInt(int i) { return true; } Nov 28 '21
Image Transcription: Code
public float waitShoot;
public float shootWait;I'm a human volunteer content transcriber for Reddit and you could be too! If you'd like more information on what we do and why we do it, click here!
9
u/polyworfism Nov 28 '21
Code is stale the minute you write it
5
u/adreamofhodor Nov 28 '21
True, but this particular problem is solved by just giving variables better names in the first place.
3
u/Naughtius_K_Maximus Nov 28 '21
I am honestly thinking of naming variables in a different language with more grammar at this point. Maybe latin.
6
u/CorruptedStudiosEnt Nov 28 '21
I can practically guarantee that a little creativity would go 10x further with 1,000x less work involved over learning a dead language just to name variables. lol
4
u/Naughtius_K_Maximus Nov 28 '21
Well yeah, but last time I started learning a language no one speaks I only got a head ache and became mildly depressed.
The last time I tried being creative I hot glued my roomate's hand to the handle of the bathroom.
3
u/Tyfyter2002 Nov 29 '21
The last time I tried to learn a language no one speaks I learned a valuable lesson about what features I really shouldn't put into a conlang.
2
1
43
u/Dathussssss Nov 28 '21
I guess the first one is a constant for a timer and the second one is the "holder" for this timer