Guild icon
Teeworlds
discord.gg/teeworlds / general
Teeworlds Discord Server.
Between 2020-06-19 00:00:00Z and 2020-06-20 00:00:00Z
Avatar
the demo recording of the race will of course be toggleable?
Avatar
ah. so a client side option. nice
00:07
oh, and would it record only successful attempts, or all from beginning to end/kill?
Avatar
good question
German joined the server. 2020-06-19 05:01:57Z
Avatar
Hiya @German - nice to meet you
Deleted User joined the server. 2020-06-19 07:25:02Z
BulgarianTee joined the server. 2020-06-19 07:25:51Z
Avatar
hi
Avatar
hello c:
Avatar
hello, question from a beginner coder what's the reasoning behind using else if here and not switch()? (edited)
Avatar
none probably, it's not a big deal
Avatar
Well it is possible that you might want to declare something in the block, which would not be allowed in a case
12:22
there are several things you are not allowed to jump over
Avatar
@Learath2 you can just { } to declare things in a case block though
Avatar
switch also has a bit weird semantic where fallthrough is the default. I guess a switch could also be used there
Avatar
yeah, I don't often see a case where switch is significantly better performing or readable. maybe it's just me 🙂
Avatar
I love switch fallthrus
Avatar
they should be explicit, they are not, unfortunately
Avatar
I spent a long time writing explicit fallthroughs because modern gcc freaks out over them
12:28
(rightfully imo)
Avatar
yeah probably should have had a fallthru; instead of break
Avatar
there is [[fallthrough]] or so iirc?
Avatar
non-standard
Avatar
standard in some C++xy
12:29
C++17
Avatar
and required for gcc not to shit walls of warnings
Avatar
Well not in C mode
Avatar
but tbh any code construct that makes programmers go "oh isn't there a bug there? ah... maybe not" isn't great
Avatar
It's natural selection
12:30
survival of the keenest 😄
Avatar
at this point just use gotos, at least they name their labels 😄
Avatar
I love gotos aswell
12:32
I love all the "controversial" features
12:32
They all have great uses ruined by people that think they know better than you
12:34
I've seen people advocate for do { ...; break; ...; } while(false); instead of a goto because goto bad
12:34
🤡
Avatar
that do-while has clearer RAII semantics to me than goto into/from blocks
Avatar
At the cost of not being readable at all
12:37
Besides, you can read on the semantics if you have concerns, just like you learned the semantics of break
Avatar
if the semantics aren't obvious or often used, I and other people will get them wrong
12:38
see e.g. for/else in python
Avatar
The solution is to reintroduce these lost features to the community. Not pretend they dont exist
12:42
Honestly when I see a feature of C++ I'm not familiar with I open up a reference. Honestly I think this is also a skill missing from most new developers. As soon as they think they start to understand a language they think their training ends
12:43
The most important thing to learn is the ability to refer to authoritative resources on any subject you learn really
Avatar
@heinrich5991 for else is a thing? til
Avatar
@Dune yes, and it's semantics are non-intuitive at first
12:45
I predicted something completely different than what it actually is
12:46
its*
12:46
now I did it as well @Learath2, it's contagious
Avatar
I got an educated guess at what it is, but I wouldnt rely on it at all
12:46
If I see a for else, I'm opening up the documentation, no question
12:47
I don't think I'll ever get rid of the habit of saying it's when I should say its
Avatar
my guess was: it's executed when the for loop has no iterations
12:48
it really was: it's executed when the loop isn't broken out of
Avatar
I thought it was the exact opposite of what it actually is
12:49
Executed when a loop is broken out of as that'd help with a common pattern
12:49
Alas, I wouldn't ever assume
Avatar
when you read code for the first time, you can't look everything up
12:50
read a code base
12:50
you have to assume some stuff. the less unintuitive features/names there are, the better
12:50
e.g. I had to work on a huuge java project for university
Avatar
@Learath2 why do you insist on authoritative sources? it's not like programming is such a political topic where anyone would want to feed you wrong information
Avatar
I definitely couldn't look up what all the functions do
Avatar
Why not? I don't read code in languages I don't know. And if I'm reading one in a language I'm not familiar with I always have documentation open
12:51
E.g. while browsing the ghidra codebase
12:52
@Dune there are a whole lot of bad resources out there, especially for C which I'm most familiar with
Avatar
it looked hopeless, trying to understand everything
12:52
I still don't know how java annotations work internally, e.g.
Avatar
Tutorialspoint saying arrays decay into pointers has us answering 10 questions a month
Avatar
but they work in some sane way that I didn't have to look up
Avatar
I don't read code in languages I don't know.
doesn't feel like a viable policy. e.g. I'm working on a C++ project, and it uses perl for testing, etc. sometimes you have to write languages you do'nt know
12:53
@Learath2 bad as in factually inaccurate or bad advice?
Avatar
I've seen both
12:54
@Dune honestly, I wouldnt dare ship anything in a language I dont know
12:55
For personally toying around with a project sure
Avatar
Not everything is critical
Avatar
But I'd still have perl documentation up on my second screen
12:57
@Dune would you contribute to a go project if you dont know atleast a bit of go?
Avatar
I would try to if I need to fix a bug that's affecting me
12:58
usually it's more that part of it is in go
12:58
e..g part of teeworlds is in python
12:58
part of it is in cmake slang too
12:58
gotta hack in both
Avatar
I had to add sha support to libtw2 in rust, a language I dont know much about. I didnt even consider contributing it back to @heinrich5991's repo
Avatar
adding new features is maybe a bit different
12:59
I'd argue a dirty bug fix is better that no bug fix, that does not hold with features in general
Avatar
Besides, if you saw something like a => in js, wouldn't you look at documentation to see what it means?
13:00
I don't see how it'd be any different for for/else in python
Avatar
don't we write for languages we don't know much of every day? I mean I write shell scripts, makefiles, cmakefiles, and I only know a bit of those
Avatar
Even though I had a guess, I've never even seen anything similar in any other language. I really don't think I'd go with my assumption
Avatar
That's true
13:01
What if C++ had a similar thing? Wouldn't you just assume the semantics?
Avatar
Probably
13:03
I make it a point to defer to people who do know things as much as I can, I do know a bit of cmake but I ask the person who actually knows when I don't understand how a construct works
13:03
or just dig into the cmake docs, which are surprisingly decent actually 😄
13:04
Actually, I'd like to weaken my position with "authoritative" sources, although I believe that is a very useful skill, I think the subset of it with referring to "known good" sources is also very important
13:05
Like cppreference for C/C++, it's actually quite useful
Avatar
I just feel like for most applications, copy pasting anthony1234's stack overflow comment and checking that it works is safe enough 😄
Avatar
That I don't think I like, people really shouldn't refer to stackoverflow so much
Avatar
I don't trust it, but sometimes any solution that works is a good solution
Avatar
I've seen so many flat out wrong answers in stackoverflow especially when it comes to C and JS
Avatar
I mean, if it's something that you can test easily it's fine
Avatar
I guess yeah, when you want to hack together something, but when you are contributing to a project, I don't think you should be copy pasting stuff from stackoverflow and not even understanding it
Avatar
if it's a hash function that could be wrong in a corner case, okay it's not fine
Avatar
Like e.g. yesterday we were trying to help a guy trying to contribute to radare2, he was calling a function in a way that didn't make sense at all, and he had written the function which baffled me
13:08
Turns out he'd just copied over the implementation of the function from a stackoverflow answer and didn't really know how to call it
Avatar
well reverse engineering tools are particularly sensitive because they make so many hypothesis and wrong results aren't immediately obvious, right 🙂
Avatar
I mean even if it wasn't radare2, would you be inclined to trust someone that contributes a stackoverflow copypasta to teeworlds and can't even figure out how to call the function he stole? 😄
Avatar
right, no
Avatar
Okay, I think my position on stackoverflow answers is, only okay if you actually understand what they do and it's not critical 🙂
👍 1
Avatar
what about if you understand what they do or you somewhat understand it and it's not critical? 😛
Avatar
you as in me or the guy who copied it over?
Avatar
okay if …
13:14
but I guess you shouldn't copy it anyway due to licensing concerns
13:14
you can take the idea
Avatar
Hm I think "somewhat understand" is where the most danger lies because you start to trust it too much
13:15
I've been bitten in the back a couple times thinking I understood an algorithm
Avatar
Anyone has a link to that old teeworlds headless client?
Avatar
@ChillerDragon
17:19
?
Exported 125 message(s)