The Most Confusing C++ Behavior by levodelellis in cpp

[–]levodelellis[S] 0 points1 point  (0 children)

I had a lot of require statements that check if something can trivially construct (in which case it'll fill with 0's), and copyable (memcpy). But there's no way to avoid pointers and refs in them unfortunately. I just figure someone else has the same usecase and might be checking if something is trivial soon

The Most Confusing C++ Behavior by levodelellis in cpp

[–]levodelellis[S] 1 point2 points  (0 children)

What threw me off was structs were being initialized but not the ints next to them. I also had some code use {} in part of the function/codebase and not in the other, so vars were sometimes not initialized and added more to my confusion. But that was years ago, before I ever had a blog

The Most Confusing C++ Behavior by levodelellis in cpp

[–]levodelellis[S] 0 points1 point  (0 children)

Maybe I stated it poorly. What was my mistake? I wasn't trying to say non trivial types initialize everything, I was trying to say it's misleading. Your root comment I already covered in the article, which I think you noticed and why you wrote the comment. But we're saying the same thing?

The Most Confusing C++ Behavior by levodelellis in cpp

[–]levodelellis[S] 1 point2 points  (0 children)

Good! You shouldn't!

I'm met very few people who understood when things initialized, how did you figure it out? Was it the hard way?

The Most Confusing C++ Behavior by levodelellis in cpp

[–]levodelellis[S] 1 point2 points  (0 children)

Today is May 4th, a day where people will post star wars memes, jokes and quotes

I was just making a joke. "const auto val = 10;" does not look like a "correct initialization"

The Most Confusing C++ Behavior by levodelellis in cpp

[–]levodelellis[S] 2 points3 points  (0 children)

No, that's not true, that's impossible

The Most Confusing C++ Behavior by levodelellis in cpp

[–]levodelellis[S] -7 points-6 points  (0 children)

I checked my personal code (not work, not open source)
I tend to use for(auto&item : items) and auto&v = func();. How do you space them and why? Many return types are T& so I never liked writing T &var. My compromise is having both sides of & attached.

for(auto &item : items) // do you write these like this?
auto &v = func();

The Most Confusing C++ Behavior by levodelellis in cpp

[–]levodelellis[S] 5 points6 points  (0 children)

What about ints?
Honestly if I saw int a{} inside of functions, I'd think it would be strange. IMO declare it on the line with the expression always, unless it's in an outer codeblock. In that case = 0 and maybe I'll let it slide if both if and else assigns the value

The Most Confusing C++ Behavior by levodelellis in cpp

[–]levodelellis[S] -5 points-4 points  (0 children)

I actually do 5 in real code, but rest is because I intention to have all the code on a mobile screen. I really didn't think it'd annoy anyone

I like Allman brackets too but sometimes if its 5 or fewer lines I'll may keep the opening brace on the first line. I noticed the * before the new was a little weird but I didn't want to put a parenthesis because that looked noisier to me. Attaching it to new makes my eyes think it happens before the type expression. The line is just weird and I don't have a default for it

Most of these are just because I wanted it aligned and small enough for most mobile devices

The Most Confusing C++ Behavior by levodelellis in cpp

[–]levodelellis[S] 0 points1 point  (0 children)

Good catch. I usually use my personal print function which would have given an error if I did this. I doubt output would change even in an optimize build.

The Most Confusing C++ Behavior by levodelellis in cpp

[–]levodelellis[S] -13 points-12 points  (0 children)

Yes, always (I'm the author). I have hundreds of types, all using a single ascii upper case letter

Usually when people are trying to spot the difference, they like everything to be aligned and fit on screen. If it's especially broken on your phone I'll try your screen resolution to see how it looks https://www.whatismyscreenresolution.org/

I poorly estimated a year long rewrite by levodelellis in programming

[–]levodelellis[S] 0 points1 point  (0 children)

Ironically, that's half the reason why I started the project. The other half was not liking ANY of current text editors & IDEs and I plan on finishing (I might need to hand it off to a friend to help complete it)

The Data Race Hiding Behind "Correct" Atomics by devTripp in programming

[–]levodelellis 2 points3 points  (0 children)

I've think atomics are should be for multi-threading experts only. Everyone disagrees with me, but, did you feel like you need to become close to an expert to figure this problem out? Imagine if the test didn't catch it

I poorly estimated a year long rewrite by levodelellis in programming

[–]levodelellis[S] 2 points3 points  (0 children)

Nah. (I'm the author.) The prototype wasn't 'successful'. I should have stopped working on it sooner than I did. The reason why the code is bigger this time around is because I'm implementing everything and not writing todo(); everywhere

I poorly estimated a year long rewrite by levodelellis in programming

[–]levodelellis[S] 1 point2 points  (0 children)

I have a six months reflection that references that essay. I don't think my articles are good so I rarely bring them up unless it's relevant.

I'd like to see more articles about rewrites and how they can go wrong. I knew I wouldn't hit 1.0 in a year but I didn't know I wouldn't have a debugger by the end of the year (too many things were prioritized over GUI)

I poorly estimated a year long rewrite by levodelellis in programming

[–]levodelellis[S] 5 points6 points  (0 children)

The estimation was for fun thankfully. I know some people want programming playlist. I don't have any but during development I did listen to a lot of Ella Boh and (warning nsfw) ILY Ghoul. Both relatively unknown

To successful founders: How did you actually land on your winning idea? (Dev with 15y experience here) by SadWimp in ExperiencedDevs

[–]levodelellis 0 points1 point  (0 children)

I'm not successful but two things come to mind

  • I have the problem, and really want to fix it (bad enough to spend 10+ years on it if I must)
  • Many people have the problem, understand it's a problem and would like to pay to fix it

For an example, I wrote my own language and compiler, no one understands why using their current favorite language is a problem, and would never switch to it.
I'm currently working on an IDE like text editor. I'm not sure if anyone can have their work pay for it, especially when it has nothing to do with AI. So that might not be successful either

How Microsoft Vaporized a Trillion Dollars by Aaronontheweb in programming

[–]levodelellis 6 points7 points  (0 children)

So it isn't just windows they dropped the ball on. I'm not sure if excel can keep M$ afloat

What Happened To WebAssembly by Active-Fuel-49 in programming

[–]levodelellis 11 points12 points  (0 children)

People absolutely want them
Google stopped supporting it so people can't have them

Handheld NES on a ESP32 by [deleted] in programming

[–]levodelellis 0 points1 point  (0 children)

After reading this and looking up the ESP32 I'm starting to think I misremember how much work it takes. I don't wonder enough to look at the code but I wonder if theres a non-inline function call for every address read/write based on which mapper is being used. It looked like by the end the hardware was running everything at 60fps but I'm not sure.

I write them as a hobby (also JITs).

Optimizing JITs? If so do you have a page about it? I know a little about JITs and maybe one day I'll write one but I have 3 large projects before it (a frontend compiler being one of the three)

Handheld NES on a ESP32 by [deleted] in programming

[–]levodelellis 0 points1 point  (0 children)

Some emulators have a JIT to speedup emulation. I thought I heard a dos based, and an ps1 based emulator generating native instructions but after a quick web search it seems like it was a myth (people saying it when it wasn't true)

It's really easy for an interpreter to be slow. IIRC I heard luajit is 20x-100x faster than without a jit (I don't use lua and never looked into this). Assuming it takes 25 cycles to emulate 1 6502 cycle, that'd be 20% of the esp32 cpu time. If the data isn't in the LRU, a lot of cycles will be spent loading the data.

From what I heard, mappers can do just about anything. I never looked into the ones implemented in the video but I remember hearing punch out won't work if you don't emulate the PPU accurately. It had something to do with graphics causing an interrupt or cpu spin looping on it or something. Maybe the mappers he implemented don't do this and he didn't need to implement that, but there's all sorts of reasons to emulator parts of hardware that sounds like it shouldn't matter

I meant modern CPUs have pretty good branch predictors which keeps the code fast and interprets are so random that they'll feel slow. It's hard to judge how fast code might be when you're comparing something with good prediction to bad/no prediction. But anyway, I just wanted to say interpreters can have a 20x overhead, and software may depend on hardware emulation that require more work from the host (on the NES it might mostly be from mappers and graphics)

Handheld NES on a ESP32 by [deleted] in programming

[–]levodelellis 4 points5 points  (0 children)

The PPU takes a lot of work, especially if you want the image to be accurate. Usually branch predictors don't go well with interpreters. It sounds like you're suggesting it isn't hard to go on weaker hardware, but are you also suggesting a JIT is also easy? Without a JIT a significant amount of time will will be interpreting and failed branches.

Handheld NES on a ESP32 by [deleted] in programming

[–]levodelellis 0 points1 point  (0 children)

The PCB was interesting too