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
redleader
Aug 18, 2005

Engage according to operational parameters

Jaded Burnout posted:

Ah, a nihilist

itym "nullhilist"

Adbot
ADBOT LOVES YOU

Athas
Aug 6, 2007

fuck that joker
When you see code checking for NaNs, it is usually either really clever code or really stupid code.

ChickenWing
Jul 22, 2010

:v:

Except that clever code is usually secretly bad code, so realistically any code checking for NaNs is bad

Jaded Burnout
Jul 10, 2004


Athas posted:

When you see code checking for NaNs, it is usually either really clever code or really stupid code.

you repeat yourself

Bruegels Fuckbooks
Sep 14, 2004

Now, listen - I know the two of you are very different from each other in a lot of ways, but you have to understand that as far as Grandpa's concerned, you're both pieces of shit! Yeah. I can prove it mathematically.

Athas posted:

When you see code checking for NaNs, it is usually either really clever code or really stupid code.

or it's javascript, where it's really easy to end up with NaNs. javascript doesn't throw an exception for a divide by zero, it just turns the number into NaN, so unfortunately NaN checking is completely justified in javascript.

The Fool
Oct 16, 2003


That's a lot of words to say "stupid code" again

Linear Zoetrope
Nov 28, 2011

A hero must cook
I tend to check NaNs and infs in functions that can diverge or otherwise blow up just so I can panic and fix it right away instead of running the computation for a day only to stop it and see "... oh, everything got polluted to NaN".

IMO, checking for NaNs and infs before sorting is also good because otherwise floats are only a partial order. It's not a huge deal because you can filter them out afterwards anyway, and if NaNs or infs ended up in your list something else is probably very wrong, but I just feel like it's bad practice to sort a list that may contain elements that symmetrically compare false.

Basically, unless things are super performance sensitive I find checking for NaNs very good, especially in numeric computing. Not to do anything with them, but so you can blow up early instead of it just silently polluting everything while your program runs for hours or days.

Goreld
May 8, 2002

"Identity Crisis" MurdererWild Guess Bizarro #1Bizarro"Me am first one I suspect!"

ChickenWing posted:

Except that clever code is usually secretly bad code, so realistically any code checking for NaNs is bad

Nan checking is necessary for any decently sized game engine, usually around skeletal animation code because it’s pretty easy to end up with singular matrices. Or really any time you’re deserializing game assets because certain programs have no problem spewing nans when an artist accidentally mangles a mesh.

ultrafilter
Aug 23, 2007

It's okay if you have any questions.


Athas posted:

When you see code checking for NaNs, it is usually either really clever code or really stupid code.

Sounds like somebody's never written a quadratic program solver....

QuarkJets
Sep 8, 2008

ChickenWing posted:

Except that clever code is usually secretly bad code, so realistically any code checking for NaNs is bad

Or it's code, good or bad, dealing with data produced by bad code

Athas
Aug 6, 2007

fuck that joker

ultrafilter posted:

Sounds like somebody's never written a quadratic program solver....

I work with lots of numerical code. That's exactly what I mean! Plenty of well written numerical code does carefully chosen things with NaNs, but also plenty of stupid code does ridiculous things with NaNs. They are a really elegant part of IEEE 758 (albeit with some warts), but now they show up in all kinds of places where they probably should not be.

boo_radley
Dec 30, 2005

Politeness costs nothing
Thread is leaking: P1152R0
Deprecating volatile
.

Foxfire_
Nov 8, 2010

Seems fine. It's not actually about deprecating volatile, just the insane person stuff that's technically allowed:

code:
volatile int WhatDoesThisEvenMean(volatile int x)
{
  return x++;
}

TheresaJayne
Jul 1, 2011

Goreld posted:

Nan checking is necessary for any decently sized game engine, usually around skeletal animation code because it’s pretty easy to end up with singular matrices. Or really any time you’re deserializing game assets because certain programs have no problem spewing nans when an artist accidentally mangles a mesh.

those shreddie nans get everywhere

https://www.youtube.com/watch?v=PshB7QYMINM

Cuntpunch
Oct 3, 2003

A monkey in a long line of kings
It's beautiful:

code:
public static bool IsValueNegativeOrZero(this int number)
{
	return number <= 0;
}

CPColin
Sep 9, 2003

Big ol' smile.
Now write a unit test for every possible int value and watch the coverage metric go through the roof!

ulmont
Sep 15, 2010

IF I EVER MISS VOTING IN AN ELECTION (EVEN AMERICAN IDOL) ,OR HAVE UNPAID PARKING TICKETS, PLEASE TAKE AWAY MY FRANCHISE

That Table of Contents is something...special.

https://forums.somethingawful.com/showthread.php?threadid=3836768

EDIT: oh god it's the whole paper too.

ulmont fucked around with this message at 17:46 on Oct 16, 2018

hackbunny
Jul 22, 2007

I haven't been on SA for years but the person who gave me my previous av as a joke felt guilty for doing so and decided to get me a non-shitty av

quote:

volatile-qualification of member functions was added to C++ to parallel const-qualification. Unlike const-qualification this never truly got used except for odd cases such as [ALEXANDRESCU]. [DE] is clearly uncertain about whether volatile-qualification of member functions is warranted. This mis-feature is either a heavy burden on Generic Programming, or something Generic Programming purposely avoids supporting because it often doubles the (already chatty) amount of Generic code.

Preach it brother

Ranzear
Jul 25, 2013

Linear Zoetrope posted:

I tend to check NaNs and infs in functions that can diverge or otherwise blow up just so I can panic and fix it right away instead of running the computation for a day only to stop it and see "... oh, everything got polluted to NaN".

Looking at you, C#, where NaN spreads like a plague.

Athas
Aug 6, 2007

fuck that joker

Ranzear posted:

Looking at you, C#, where NaN spreads like a plague.

What does C# do different than any other language? Is there any language where NaNs do not behave in the usual viral IEEE 754 way?

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice

Athas posted:

What does C# do different than any other language? Is there any language where NaNs do not behave in the usual viral IEEE 754 way?

Much that once was is lost, for none now live who remember it.

Soricidus
Oct 21, 2010
freedom-hating statist shill

ulmont posted:

That Table of Contents is something...special.

https://forums.somethingawful.com/showthread.php?threadid=3836768

EDIT: oh god it's the whole paper too.

quote:

They’re used with quiet determination, avoiding serious code. In doing this with volatile C adds a small, sullen syntax to the larger, hollow one. It makes an alloy of sorts, a counterpoint.

:psyduck:

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
Yeah, JF is very pleased with himself about that paper, and I can’t quite bear to break it to him that it’s really just annoying.

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice

rjmccall posted:

Yeah, JF is very pleased with himself about that paper, and I can’t quite bear to break it to him that it’s really just annoying.

Sometimes a little goes a long way. I'd be funnier and more effective to dial it back a bit.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
Ok I’m glad I wasn’t the only one doing the internet-reading-equivalent of a nervous chuckle as I locate the nearest exit.

JawnV6
Jul 4, 2004

So hot ...
I know exactly one human who both uses volatile and has read the Kingkiller series. He even tolerates C++ far more than I do, if there's anyone on the planet who can appreciate it I'll know tomorrow.

hackbunny
Jul 22, 2007

I haven't been on SA for years but the person who gave me my previous av as a joke felt guilty for doing so and decided to get me a non-shitty av
I agree with the proposal, in principle (haven't read it in detail because #yolo). There's a lot about the current incarnation of volatile that plain doesn't make sense, and even gives dangerous, wrong ideas to programmers (like that incrementing volatiles is atomic). And, as I mentioned, I have written generic code that overloads on both const and volatile (and both lvalue and rvalue references) and "pain in the rear end" is an understatement

hackbunny fucked around with this message at 02:47 on Oct 17, 2018

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
So, part of the problem with overloading by qualification is that the language only actually acknowledges two qualifiers when basically every compiler adds several more: restrict, address spaces, and dialect-specific features like the ObjC ARC ownership qualifiers, not to mention a bunch of type attributes that aren’t quite qualifiers like calling conventions. Some features in C++, like fully-opaque templating, naturally support this complexity because they only test whether a particular expression syntax works. Unfortunately, other features like structural template argument deduction and non-static member function qualification run into a big brick wall because they rely on at least partially destructuring a type, so unless you include a case for every combination of extended qualifiers in your language, they basically can’t be combined with these language extensions. So my concern with this proposal is that it’s in part trying to address a deeper problem — C++ is bad at handling some kinds of polymorphism — by defining it away for volatile so that it’s just about const, when actually it can’t be defined away like that if you take the extensions seriously.

Falcorum
Oct 21, 2010
You people and your fancy languages complaining about NANs. In shader code, we just add 0.00001f to any division that may result in a divide by zero and hope for the best because the alternative is usually too expensive. :v:

hackbunny
Jul 22, 2007

I haven't been on SA for years but the person who gave me my previous av as a joke felt guilty for doing so and decided to get me a non-shitty av

rjmccall posted:

So, part of the problem with overloading by qualification is that the language only actually acknowledges two qualifiers when basically every compiler adds several more: restrict, address spaces, and dialect-specific features like the ObjC ARC ownership qualifier

__unaligned!

rjmccall posted:

So my concern with this proposal is that it’s in part trying to address a deeper problem — C++ is bad at handling some kinds of polymorphism — by defining it away for volatile so that it’s just about const, when actually it can’t be defined away like that if you take the extensions seriously.

It should probably be split into two different proposals, one for restricting the kinds of operations that are legal on a volatile and/or the kind of objects that can be qualified volatile, one for addressing qualifier explosion in generic code

Absurd Alhazred
Mar 27, 2010

by Athanatos

Falcorum posted:

You people and your fancy languages complaining about NANs. In shader code, we just add 0.00001f to any division that may result in a divide by zero and hope for the best because the alternative is usually too expensive. :v:

Look at this sucker, dividing in shader code. I get most of my NaNs from incomplete texture attachments. :smaug:

Falcorum
Oct 21, 2010
Incomplete texture attachments crash things nowadays (sometimes :v:)!

Does the entirety of Scaleform count as a coding horror? Its batching is so terrible that nearly 1/3rd of the GPU frametime is rendering scaleform UI elements.

(and don't get me started on the CPU usage, that thing allocates more garbage in a single frame than the rest of the game does in like 10 seconds)

Carbon dioxide
Oct 9, 2012

Um.

Is this serious or are they trolling?

https://sqlite.org/codeofconduct.html

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
Both.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
Well that’s disappointing.

Though I can’t say I’m shocked that SQLite went down the idiosyncratic route.

Volguus
Mar 3, 2009

pokeyman posted:

Well that’s disappointing.

Though I can’t say I’m shocked that SQLite went down the idiosyncratic route.

I wouldn't be surprised for this to be the answer to some idiot coming and asking for a code of conduct (as they are known to do) and then making a fuss when they're told to take a hike. Have one, that will shut them up. Make it ridiculous, have a good laugh about it. Then just go on your merry way and not worry about it.

JawnV6
Jul 4, 2004

So hot ...

Volguus posted:

some idiot coming and asking for a code of conduct (as they are known to do)
Hah! Those idiots!

Carbon dioxide
Oct 9, 2012

Nope, turns out it's completely real. The main SQLite creator is a very religious guy and is completely serious about this. You can go look up his website and the posts on the SQLite mailing list if you want proof.

JawnV6
Jul 4, 2004

So hot ...

JawnV6 posted:

I know exactly one human who both uses volatile and has read the Kingkiller series. He even tolerates C++ far more than I do, if there's anyone on the planet who can appreciate it I'll know tomorrow.

Oh, right, I learned something: Herb Sutter is also a fan of the Kingkiller series, and was on the review for this. So the cringe-inducing parts were for someone.

tbh I never considered some of the corner cases around incrementing, in the i-dont-care-if-this-tears variety, but still think there should be some way to specify "please spin on this BS operation that you know is BS for Reasons"

Adbot
ADBOT LOVES YOU

Volguus
Mar 3, 2009

Carbon dioxide posted:

Nope, turns out it's completely real. The main SQLite creator is a very religious guy and is completely serious about this. You can go look up his website and the posts on the SQLite mailing list if you want proof.

Well, well, well. He is serious. Would have never thought. Well, good luck to him then. SQLite still is a very good project and until it ceases to be so I'll still use it.

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