|
hyphz posted:Ugh, yes, reference semantics wind me up. We teach languages in the order Python, Java, C/C++ and the Python and Java sessions both elide any mention of the reference model because it’s “too complicated”. Then when the students hit C’s explicit pointers they freak out completely. my school's CS program taught ARM assembly and C in the first two semesters and made students program an rc car on a cortex m3 chip to drive around a racetrack at least when you know what a register is and wtf the difference between eax and [eax] is, it's really easy to understand C pointers
|
# ¿ Dec 12, 2022 20:01 |
|
|
# ¿ May 21, 2024 09:35 |
|
std::array is not dynamically allocated, that's the whole point of using it over vector
|
# ¿ Dec 28, 2022 19:44 |
|
Per the article Xarn linked above, go generics are only actually compile-time generics for basic datatypes like int32 / float64. For every pointer-to-object type, the compiler generates a single dynamic void* implementation shared between all types that looks up the required vtables in a global shared cache at runtime. This makes it perform worse than just using a non-generic polymorphic function and accepting an interface pointer, since at least for those the vtables are passed in alongside the function arguments. RPATDO_LAMD fucked around with this message at 01:37 on Jan 9, 2023 |
# ¿ Jan 9, 2023 01:35 |
|
if your variable names are ambiguous enough to provoke a big annoying argument like this you should ensure there is actual documentation (or at least a comment over the function definition) specifying the actual range of inputs instead of leaving your readers to infer it because whether you think your side is right or wrong someone from the other side is gonna read your code someday
|
# ¿ Jan 17, 2023 22:09 |
|
Qwertycoatl posted:I wonder what maintenance problems you get with a giant struct that you don't get wth 26 somewhat less giant structs grouped by name rather than purpose. It looks like they did it this way so each struct can have its own magic-number sentinel value at the end, letting them check (at runtime) to see whether the struct definition and and its initializer list have gotten out of sync i guess that's easier than figuring out which entry in a multi-hundred-line struct is missing but it still seems like it could be replaced by a compiler warning flag? from decl.c: C code:
C code:
RPATDO_LAMD fucked around with this message at 20:43 on Jan 19, 2023 |
# ¿ Jan 19, 2023 20:37 |
|
LongSack posted:I would use a switch expression: That's identical to the original dutch-government thing that set this discussion off
|
# ¿ Jan 22, 2023 00:20 |
|
Bruegels Fuckbooks posted:it's more that it's a high int low wis solution to a problem that probably took a significant amount of work to pull off. someone probably had the thought "hey, what if we just made each OS sleep and had them switch between the two" and then had the balls to keep going when they kept finding problems. doing the amount of work that they did to get this to work and getting a bad result (it's still loving slow to switch between the OS anyway) is a tragedy. i've dealt with engineers that can get anything to "work" given enough time and who would always double down on poo poo like this before and it's super frustrating working on a project that's fundamentally doing something that it shouldn't be doing. Correction: it wasn't slow to switch OSes, article guy clocked it as only 6s to go from windows to linux. But the whole reason they added it was as an "instant-on" alternative to avoid slow initial boot-up speeds for Windows, and it did nothing to help that -- the initial boot was about the same speed.
|
# ¿ Mar 27, 2023 20:13 |
|
Volte posted:My favourite Windows start menu search behaviour (which thankfully seems to be fixed in Win11) was typing "VLC" and the first highlighted result was "VLC media player - reset preferences and cache files" instead of the main application. W10 still seems to use some kind of unpredictable/unstable search ranking function. If I type "Ch" the first result is "Google Chrome", but if I then continue and type "Chr" it replaces the first result with my "Google Chrome Guest mode" shortcut -- it replaced the original #1 match despite it still being an exact result. Similarly, a search of "volum" pops up "Adjust Volume -- system settings" in the control panel, but "volume" brings up "Sound mixer options" instead. RPATDO_LAMD fucked around with this message at 05:52 on Mar 30, 2023 |
# ¿ Mar 30, 2023 05:49 |
|
Toshimo posted:You're the one who told us you just type random commands into you Unix prompt and hope they do something non-catastrophic. Which just lmao if that's the case. are you aware of tab completion? there's a difference between "mash my keyboard randomly and hope something good happens" vs "type the first 3 letters of some niche rarely-used command I half-remember and then let my terminal list out the completion possibilities"
|
# ¿ Apr 2, 2023 20:38 |
|
Loezi posted:
|
# ¿ Jul 3, 2023 07:13 |
|
Hammerite posted:motherfucker, your login name is not necessarily the same as your publicly visible steam account name and if like me you only used steam on one pc and had it set to auto sign in you might have not actually seen that login name for years e: wait this is the coding horrors thread not the steam thread
|
# ¿ Jul 21, 2023 06:43 |
|
Any info online on how to tweak some config value in the registry is always surrounded by multiple paragraphs of "this is dark magic and your computer is going to explode if you touch anything wrong make sure to save 7 backups first". End users are absolutely terrified of the registry compared to config files.
|
# ¿ Sep 26, 2023 02:02 |
|
It looks pretty stupid for 1-argument constructors like that where you can just use "Fart fart = 42" but it can be nice to cut down repetition for multi-arg constructors where you actually do have to type out the constructor name for example if I want to make a vector with 10 pre-initialized objects: C++ code:
|
# ¿ Oct 16, 2023 23:45 |
|
is the horror that public posts on a social media website are visible on its public api? surely even if they required that the api consumer have a "bsky invite code" during the closed beta period it would make no difference, that data is out there anyway. if someone wanted to scrape stuff they could finagle a code from somewhere
|
# ¿ Oct 17, 2023 03:26 |
|
Plorkyeran posted:Doesn't Roblox skip the step of paying them actual money, though? it pays them in "robux", which can technically be cashed for real money but only for around 1/4th the amount it costs to buy robux.
|
# ¿ Oct 21, 2023 22:51 |
|
i would really not recommend turning in transpiled or otherwise machine-generated code for a school assignment assuming the professor is even the smallest bit competent they will have some level of human-beings-actually-looking-at-the-code (even if it's just TAs) beyond just automatic grading.
|
# ¿ Nov 18, 2023 02:43 |
|
ExcessBLarg! posted:As the rest of the thread is kind of beating around, it's interesting to me that this course uses C++ as the language of instruction. Most schools switched to Java or C# some 20 years ago, because even back then C++ was a language with a lot of legacy and baggage, and the nuances of C++ aren't easy for a novice to decipher and, simultaneously, distract from the actual learning of data structures and algorithms. It's a data structures and algorithms course. Understanding the difference between a linear scan and a hashmap/etc lookup and when you'd use one over the other is precisely what they're being graded on. That's probably the best subject matter to have runtime-based tests for since if someone's time complexity is higher than it ought to be it's easy to blow it up. Also how would you teach stuff like trees and linked lists in a 'friendly' language without pointers like java or python? Ihmemies posted:Actually no. ”does this make sense” or “what would be a good choice when implementing X” are very forbidden questions. “Why is this so slow”.. haha, they always say you have to figure it out yourself. If something literally doesn’t work they might give some advice, after a while. This part really sucks though. I understand not giving students the answers but they should point em to profiling tools or something RPATDO_LAMD fucked around with this message at 03:21 on Dec 10, 2023 |
# ¿ Dec 10, 2023 03:17 |
|
The syntax is a lot worse when it doesn't differentiate between reference and value types like that imo. But C++ has the same sin with its own references.
|
# ¿ Dec 10, 2023 07:40 |
|
I took an elective "number theory and cryptography" course where the professor was in that same "I don't care about what language you use just get the math parts right" stance. We had to implement a bunch of things in software like various prime factorization algorithms, and eventually asymmetric key encryption. However at my school it listed a CS course as a prerequisite. I feel like I was the only one there using Python (it has native arbitrary-precision integers! so nice for this.) while everyone else was struggling with some third party C++ BigInt library since the prereq class taught C++.
|
# ¿ Dec 10, 2023 21:13 |
|
ExcessBLarg! posted:To refine my earlier point, I'm struggling to think of an example of needing 100+ "else if" blocks that couldn't be written in a better (whether stylistic or performant) way. you have some pretty weird standards if you think 100 if-elses is bad but 100 switch cases is suddenly good / "better" it's all the same poo poo
|
# ¿ Dec 22, 2023 10:48 |
|
what yall really need is some solid mathematical background for your IsEvensPython code:
|
# ¿ Apr 8, 2024 21:47 |
|
Hammerite posted:I was going to say that it should be ok because no initialization of variables was being skipped, but actually it potentially is if I understand correctly. "this is bad because if you gently caress with internal object state you can put it in an invalid state" is a very "you're holding it wrong" kind of problem to have the real problem is that it's using the switch as a fancy goto which is just fucky and unintuitive to read. you could easily refactor this to use separate start(), loop(), done() functions instead of jumping into the middle of a block of shared code.
|
# ¿ Apr 10, 2024 21:40 |
|
|
# ¿ May 21, 2024 09:35 |
|
Cmake is designed to find dependencies by "magic" through functions like find_package, which basically end up looking for a hand rolled script for each package or else searching in a few standard folders like /usr/lib etc Getting that poo poo to work on windows which has no standard folder structure anywhere for libs, includes, etc is a pain in the rear end, and because of all the "magic" involved specifying the folder locations explicitly ends up being more verbose and much less obvious than it would've been with a dumb non-magical build system like a plain makefile. And yes the documentation is really poo poo for this with a lot of super general detail on how the various functions work and no simple hello-world examples for "holy poo poo I just wanna link to a library it's RIGHT THERE please just show me three lines of code/config that will do this" it seems like a pretty good system as long as you (a) never touch windows and (b) never have to actually write the drat cmake files yourself
|
# ¿ Apr 29, 2024 06:50 |