Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
namlosh
Feb 11, 2014

I name this haircut "The Sad Rhino".
I call * the anus operator

Adbot
ADBOT LOVES YOU

SirViver
Oct 22, 2008

namlosh posted:

I call * the anus operator

It's an assterisk

OddObserver
Apr 3, 2009

namlosh posted:

I call * the anus operator

There is probably an inappropriate joke involving -> there...

QuarkJets
Sep 8, 2008

namlosh posted:

I call * the anus operator

You're going to get sued for trademark infringement by some proctologists

ultrafilter
Aug 23, 2007

It's okay if you have any questions.


https://twitter.com/AvidHalaby/status/1602127460677844993
Thread

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

wtf

they are going to get destroyed by gdpr if half of this is true

CPColin
Sep 9, 2003

Big ol' smile.
This does help explain why basic-rear end stylesheet errors would randomly show up in Production

Zopotantor
Feb 24, 2013

...und ist er drin dann lassen wir ihn niemals wieder raus...

OddObserver posted:

There is probably an inappropriate joke involving -> there...

C++ has a ->* operator…

QuarkJets
Sep 8, 2008

Zopotantor posted:

C++ has a ->* operator…

The operator is named DEREFERENCE THAT rear end

Presto
Nov 22, 2002

Keep calm and Harry on.
Actually it's a pointer-to-member. :quagmire:

mmkay
Oct 21, 2010

Wouldn't it be a pointer from member?

duck monster
Dec 15, 2004

Volmarias posted:

I cannot emphasize enough how damaging this was for my attempts at learning programming as a child.

Buddy, if you aren't looking at code you wrote as an adult several years ago and thinking "what absolute derp thought this was acceptable" before you realize it was you, either you're not growing or you're much better than any of us.

Oh I assure you I do that often. Especially stuff I wrote in my 20s back in the 90s and early 2000s. That poo poo was just amateurish.

Hell sometimes I look at code I've just written and thought "wtf dude, your better than this..."

dougdrums
Feb 25, 2005
CLIENT REQUESTED ELECTRONIC FUNDING RECEIPT (FUNDS NOW)
I want github to add a feature where if you git blame a line and it shows you as the author, the price is right losing sound plays

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe
tfw you look at code you wrote yesterday and thought "gently caress it, that'll do"

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

Hammerite posted:

tfw you look at code you wrote and thought "gently caress it"

ultrafilter
Aug 23, 2007

It's okay if you have any questions.


Hammerite posted:

tfw gently caress it

dougdrums
Feb 25, 2005
CLIENT REQUESTED ELECTRONIC FUNDING RECEIPT (FUNDS NOW)
when the linter warns on todo comments and you’re like shut the gently caress up why do you think it says todo

Ranzear
Jul 25, 2013

dougdrums posted:

when the linter warns on todo comments and you’re like shut the gently caress up why do you think it says todo

code:
#![cfg_attr(debug_assertions, allow(dead_code, unused_imports))]
My favorite declaration. Are we --release? No? Shut the gently caress up!

hyphz
Aug 5, 2003

Number 1 Nerd Tear Farmer 2022.

Keep it up, champ.

Also you're a skeleton warrior now. Kree.
Unlockable Ben
Anyone ever looked at il2cpp output? I’ve been looking at some and it’s, um, weird. Stuff like null-checking EVERY time a variable is read, even if it’s already been read before in the same routine. Yea, I know, threads, but if you have to be that paranoid then your thread discipline is shot. And in any case the game has no way to recover from one of the pointers being null do all it does is to go haywire by skipping necessary code, instead of doing a controlled crash.

Also it looks like the author copy and pasted code to count down every one of ~10 cooldowns manually..

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
It's usually not worth independently doing a whole bunch of optimisations (like eliminating redundant checks) when the compiler that will later turn that into actual machine code has a much better optimizer that will do them for you.

Focusing on a correct transformation that easily and obviously maps back to the original source is usually the way to go.

hyphz
Aug 5, 2003

Number 1 Nerd Tear Farmer 2022.

Keep it up, champ.

Also you're a skeleton warrior now. Kree.
Unlockable Ben
Thing is, this is decompiled il2cpp. That should have already happened.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
In that case, I'm not sure you should be making a big deal out of "copy and pasted code" when it's most likely just an unrolled loop.

more falafel please
Feb 26, 2005

forums poster

il2cpp probably does a lot of optimizations in the C++ it emits in order to gently persuade the compiler to do optimizations such as unrolling loops if it makes sense. I wouldn't be surprised if Unity knows what compiler it's going to be ultimately using and can specifically target that. I've only used it with MSVC and clang, but those are both pretty knowable and have directives that can aid optimization.

Aryoc
Nov 27, 2006

:black101: Goblin King :black101:
Grimey Drawer
Since IL2CPP has to maintain the same behaviour as you had with the original C# it has to raise a NullReferenceException if you access a null value, as mentioned you absolutely can have a variable become null in-between calls if it's accessed from a different thread so the right behaviour is to null check before every access. Having it generate code that will lead to undefined behaviour in C++ by default would be much worse.

If you're absolutely sure a value is not and can not become null you can disable null checks by using the
code:
[Il2CppSetOption(Option.NullChecks, false)]
attribute.

hyphz
Aug 5, 2003

Number 1 Nerd Tear Farmer 2022.

Keep it up, champ.

Also you're a skeleton warrior now. Kree.
Unlockable Ben
I think it's having a lot of faith in Unity to assume it optimizes compiler specifically! :)

I could understand throwing an exception somehow, but instead it seems that it just exits the function if a null is encountered, presumably because there was nothing to handle the NPE in the original program. Which while it avoids low-level undefined behaviour by accessing null memory, does provoke high-level undefined behaviour because no other part of the program is robust to the function having returned without completing its job.

Another one I didn't realize wasn't being optimized: it calls the property getter for fixedDeltaTime every time it's referred to. I'm pretty sure that's a performance hit due to crossing the script/engine boundary.

duck monster
Dec 15, 2004

dougdrums posted:

I want github to add a feature where if you git blame a line and it shows you as the author, the price is right losing sound plays

Or bombards them with rubber missiles.
https://github.com/codedance/Retaliation

EoRaptor
Sep 13, 2003

by Fluffdaddy
https://www.youtube.com/watch?v=7hdJQkn8rtA

Dijkstracula
Mar 18, 2003

You can't spell 'vector field' without me, Professor!


how timely, a clip of this was in the latest Technology Connections and I was curious to find the whole thing

EoRaptor
Sep 13, 2003

by Fluffdaddy

Dijkstracula posted:

how timely, a clip of this was in the latest Technology Connections and I was curious to find the whole thing

Hmm, yes, I wonder how that happened...

Dijkstracula
Mar 18, 2003

You can't spell 'vector field' without me, Professor!

EoRaptor posted:

Hmm, yes, I wonder how that happened...

*checks YT account...*

:doh:

Only registered members can see post attachments!

Ranzear
Jul 25, 2013


I know it's the times but my biggest takeaway is plainly "Don't write in languages with really lovely syntax".

Also they totally did change the program by changing the ≤ to <. If there's 133 orders total, 33 returns now skips the increment. Who knows what kind of other logic, like a strictly Greater Than 0.33 elsewhere, might be paired with or reliant on that ≤ and is now a corner case if not plainly incorrect.

Also only now noticing they subtract returns from total orders, so 50 returns on 100 orders is ... 100% return rate. That's probably the real bug they were trying to fix before getting off in the weeds and breaking something else. This is the realest programming video ever!

Ranzear fucked around with this message at 14:20 on Dec 27, 2022

biznatchio
Mar 31, 2001


Buglord
"Is that really a precise statement?"

"Sure it is, just look at the program."

"YOU look at it."

SupSuper
Apr 8, 2009

At the Heart of the city is an Alien horror, so vile and so powerful that not even death can claim it.

Ranzear posted:

I know it's the times but my biggest takeaway is plainly "Don't write in languages with really lovely syntax".
The language is made-up, the point is to not let syntax dictate readability. You can't change the language, you can only format it.

more falafel please
Feb 26, 2005

forums poster

SupSuper posted:

You can't change the language, you can only format it.

Get a load of this person who doesn't even use Perl

EoRaptor
Sep 13, 2003

by Fluffdaddy

Ranzear posted:

I know it's the times but my biggest takeaway is plainly "Don't write in languages with really lovely syntax".

Also they totally did change the program by changing the ≤ to <. If there's 133 orders total, 33 returns now skips the increment. Who knows what kind of other logic, like a strictly Greater Than 0.33 elsewhere, might be paired with or reliant on that ≤ and is now a corner case if not plainly incorrect.

They talk about how the .33 is an approximation of 1/3rd, so dropping the 'or equal too' isn't going to change the results in meaningful way.

shame on an IGA
Apr 8, 2005

EoRaptor posted:

They talk about how the .33 is an approximation of 1/3rd, so dropping the 'or equal too' isn't going to change the results in meaningful way.

Later they changed the < to > and didn't explain the rationale for that very major change at all tho

Toshimo
Aug 23, 2012

He's outta line...

But he's right!

shame on an IGA posted:

Later they changed the < to > and didn't explain the rationale for that very major change at all tho

Are you sure you watched the video? Because they clearly spelled that decision out.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem

shame on an IGA posted:

Later they changed the < to > and didn't explain the rationale for that very major change at all tho

They changed it from "if a < b, skip this next section" to "if a > b, do this section". That's not quite as "major" a change as you seem to be imagining.

Consider also that when this video was made, Dijkstra's "GoTo Considered Harmful" letter (and the general concept of structured programming) was still pretty new and not necessarily widely practiced. The motivation for this change is literally to introduce structure to the code to make it easier to follow and understand.

shame on an IGA
Apr 8, 2005

Jabor posted:

They changed it from "if a < b, skip this next section" to "if a > b, do this section".

ohhhhhhhh yeah I definitely missed that

Adbot
ADBOT LOVES YOU

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

Very pro click right here, it's great advice and it's way, way ahead of its time.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply