So what’s 0 do then? I’m okay with wacky indexes (I’ve used something with negative indexes for a end-index shorthand) but 0 has to mean something that’s actually useful. Using the index as the offset into the array seems to be the most useful way to index them.
Traister101
Yo whatup
- 0 Posts
- 31 Comments
If your joking yes, if your not Java and Java Script are seperate things.
Uninitalized memory (
int a;
with no assignment) vector of int vectors (IE a dynamicint[][]
) and attempting to finda
, anint
in the vector of vectors of int IEint
instead ofvector<int>
. I think the iterator type is correct but I’m not sure off the top of my head
Traister101@lemmy.todayto Programmer Humor@programming.dev•Next month is gonna be rough161·5 months agoYou don’t have to be religious to think a fat dude in some red clothes that magically travels around the world giving out presents to good children isn’t a fun yearly tradition. Frankly it’s kind of an overdramatic reaction to a small red hat overlaid onto an icon. Should configuration be provided to disable the functionally? Sure I don’t care, hell have it disabled by default I don’t mind but it’s stupid to make a huge stink about something so minor.
JetBrains has really nice Git integration. Interactive rebaseses and merges are quite pleasant but I’m still dipping into the command line to do stuff occasionally. Most commonly a
git reset HEAD~
cause I want to split a commit though I had to dig through the reflog the other day cause I suddenly realized I lost an important branch that ended up being over a hundred commits back.
Traister101@lemmy.todayto Programmer Humor@programming.dev•"GitHub CI is easy", he said. "It's just `bash` ", he said.4·6 months agoAct works out pretty good but you need to pass it a token and stuff so the actual github CLI bits can work which is kind of a hassle. It took me much too long to discover you need a classic token, the one from the github CLI app
gh auth token
won’t work.Edit: Ah! Also getting act setup involved getting docker setup which involved me enabling virtualization in my bios for what I swear is like the 4th time I’ve done so. Also because I’m on Windows (iirc at least) I had to setup WSL or just make a windows container ಠ_ಠ
Traister101@lemmy.todayto Programmer Humor@programming.dev•You seen the jank? I live in it.. molded by it...3·6 months agoI’d say in most cases that’s a sign something needs to be extracted into a separate function. Course sometimes code is just complicated and extracting only makes things harder to follow. Even then I’d much rather use early return than nested
if
s as those are significantly harder for me to follow.
Traister101@lemmy.todayto Programmer Humor@programming.dev•You seen the jank? I live in it.. molded by it...6·6 months agoMy code got much more readable when I learned about early returns lol
And the entire stack trace
Wow, that looks like a nightmare
Yep that’s why I refuse to use standard libraries. It just makes my code too complicated…
Traister101@lemmy.todayto Programmer Humor@programming.dev•Not really sure whether S-expressions or Python indentation-based scoping get more hate...274·11 months agoSemantic whitespace is awful because whitespace (something that you can’t actually see) has meaning in how the program runs. Braces
{
}
for scopes gives you the ability to easily tell at a glance where a scope ends. Whitespace doesn’t allow for that. Especially, especially when you can accidentally exit a scope (two new lines in a row with Python) and it’s not actually an error (Pythons global scope). Yeah formatters and linters make this less of an issue but it sucks… Languages with legible symbols for scoping are significantly easier to reason about, seeend
symbols in Lua.
It erases the type of what your pointing at. All you have is a memory location, in contrast to
int*
which is a memory location of an int
Traister101@lemmy.todayto Programmer Humor@programming.dev•Perpetual Motion finally achieved!4·1 year agoSmart pointers model ownership. Instead of (maybe) a comment telling you if you have to free/delete a returned pointer this information is encoded into the type itself. But that’s not all, this special type even handles the whole deleting part once it goes away.
Since they model ownership you should only use them when ownership should be expressed. Namely something that returns a pointer to a newly allocated thing should be a
std::unique_ptr
because the Callie has ownership of that memory. If they want to share it (multiple ownership of the object) there’s a cheap conversion tostd::shared_ptr
.How about a function that takes in an object cause it wants to look at it? Well that doesn’t have anything to do with ownership so make it a raw pointer, or better yet a reference to avoid nullability.
What about when you’ve got a member function that wants to return a pointer to some memory the object owns? You guessed it baby raw pointer (or again reference if it’ll never be null).
Traister101@lemmy.todayto Programmer Humor@programming.dev•Companies are not your friend471·1 year agoJetBrains might not be my friend but they don’t hold anywhere near the dev tool monopoly Adobe does for artists. Know what happens if JetBrains starts to blow massive ass? I finally sit down and figure out how to get my terminal editor working with my LSP. Yeah I lose some productivity but not as much as I’d lose by using Visual Studio or fuckn Eclipse.
Thanks for well contributing to Lemmy but you sure are quite the annoying character. Now don’t go and abuse your newfound abilities and remove the blocking feature <3
Instance of Vim? Swap buffers fool
Looking at code on somebody else’s screen is entirely missing the point of using tabs over spaces. The entire point is that mine looks like how I want and theirs looks like how they want even though the file is identical. We can each have wildly different tab width and it’ll look wildly different to each of us when we program. That’s again the point.
Code formatters are great! I love them. Using tabs over spaces is objectively a better formatting option. One of my favorite features in code formatters is that they’ll swap out spaces to tabs for you insane people who insist on mashing the space bar to indent.
What’s yaml have to do with anything? It’s like python with syntactic whitespace which is unrelated to this discussion. The Tab vs Space debate is entirely around non syntactic whitespace which doesn’t effect how the code is parsed. And yes Python technically does both tabs and spaces but it’s all sorts of fucky.
Terminal editors while still used a ton aren’t really what I was referring to. Newer terminal editors such as Helix have tab width configured per language most of which default to a width of 4 spaces but toml/yaml both default to 2 spaces. I was mainly referring to GUI editors as frankly that’s just what most people use nowadays. JetBrains IDEs, Visual Studio, Eclipse, VS Code, Notepad++ were primarily what I was thinking of as I’ve used all of them and they all default to a tab width of 4 hence why I said nearly universal. Also I said nearly terminal editors being the only editors I’ve used that don’t default to a width of 4 seems like a fair usage of the term.
Ah yes now I can… dereference a raw pointer (yes that’s essentially the only thing unsafe rust actually enables you to do, it doesn’t disable the borrow checker or anything else, it just allows you to play with pointers)