« first day (1627 days earlier)      last day (3323 days later) » 

5:00 PM
@R.MartinhoFernandes OK, this is a trivial example. But underflow/overflow for signed types is UB while a defined wrap for unsigned types. No UB still sounds better.
 
@Xeo Please convince me with evidence :)
 
Yes, it is a trivial example.
 
I'm prepared to be convinced
 
That's my fucking point.
It's just 1-2.
 
5:00 PM
cursory glance at C++11 doesn't help though
 
Not huge number * huge number or something.
 
does it make sense to create a type class just for a type family?
 
Xeo
@LightnessRacesinOrbit Do you not believe it for signed or unsigned types? :P
 
@Xeo signed, duh
 
Xeo
wat
 
5:01 PM
;p
what do you mean wat
everybody knows 1-2 is well-defined for unsigned types
 
Xeo
hey, just getting the state of things right. don't confuse me now :(
 
@wilx You chose to have 1-2 produce garbage so you can I-don't-even-know-what when you add two huge numbers.
 
oh fuck 1-2 is only -1
well, look, I meant like INT_MIN-1 ok ;p
 
Xeo
and we weren't talking about that
 
that was like the first thing I learned in programming
 
5:02 PM
yes, we were talking about underflow.
 
that if I want to subtract I need integer, not word
I was actually afraid of 32 bit types back then
they scared me
I was like "I better not ask the computer for more memory than I really need"
 
@wilx No UB is only really preferable if the garbage you get from the well-defined unsigned result won't cause UB on the next instruction.
Unless you have those checks there, I'll maintain that you chose the worst of the two options.
 
personally I think that the treatment of overflow is pretty dumb in C++
they should offer the option of over/underflow or UB for both signed and unsigned.
 
@R.MartinhoFernandes Why do you keep saying that 1u-2u is "garbage"?
 
@Puppy I appreciate unsigned integer arithmetic, and your suggestion is idiotic anyway.
 
5:06 PM
@LightnessRacesinOrbit Unless you need modular arithmetic, it is.
 
@R.MartinhoFernandes That's an absurd thing to say.
 
Bratek-style logic being employed
 
a > b => b - a < 0.
 
"Unless you need this value, it's 'garbage'."
What nonsense.
 
5:07 PM
@LightnessRacesinOrbit Context.
 
@Columbo Er, why? I don't see how offering the user a choice in what semantics he needs is an idiotic thing to do, since both have advantages in different situations.
 
No context can make the claim any less nonsense.
 
I made an effort to single out modular arithmetic as a separate case.
 
Sigh. I'll come back later.
 
@LightnessRacesinOrbit Oh, yes there is: the context where you want regular arithmetic.
 
5:08 PM
ITT regular arithmetic involves "garbage"
 
runModule :: (Module i c m) => ModuleFn m a b -> (a -> c (b, m))
 
@LightnessRacesinOrbit No?
 
I'm getting too old for this shit
 
@LightnessRacesinOrbit Regular arithmetic has properties like a > b => b - a < 0.
 
5:08 PM
@Puppy First, let's agree upon the fact that making unsigned overflow UB is entirely impractical.
 
Yes, I know what regular arithmetic is.
We are talking about your assertion that a value is 'garbage' when you don't need it.
You introduced a context factor, the context being that you want regular arithmetic.
 
Xeo
@Columbo It's just a wording change.
 
Then you denied my observation that you suggested regular arithmetic involves 'garbage'.
I don't really know what to make of all this tbh.
 
no, I'm not really feeling any agreement here.
 
@LightnessRacesinOrbit I introduced that back in the beginning.
 
Xeo
5:09 PM
Just because you say "UB" doesn't mean it has to have nasty results.
 
@R.MartinhoFernandes Doesn't really matter when you introduced it.
 
@LightnessRacesinOrbit Using modular arithmetic where you need regular arithmetic produces garbage.
 
if the user decides he has a situation in which UB is impractical, he can opt for over/underflow.
 
It's also a horrible word
And I care more about that :)
 
5:10 PM
@LightnessRacesinOrbit It does. If you want to discuss something else, you can do it with someone else. I chose to discuss the usage of unsigned types for regular arithmetic.
 
@R.MartinhoFernandes I'm not "discussing something else". I'm discussing this. With you. Please do not take "I disagree with you" to automatically mean "I want to discuss something else". Because that's not a good way to debate anything.
 
@Xeo But it takes a guarantee away that I need when having to write portable code.
 
who said anything about taking it away?
 
Xeo
@Columbo If you need that guarantee, just use the over/underflowing version.
 
I merely said that the user should be able to opt for UB.
 
5:11 PM
1-2 takes away 2 dumbass
 
not that it should be the default.
 
If I pointed a gun to your head and forced you to, how would you all typically write a setter function when you had to care about performance? by value? two separate setters with const ref and rval?
 
@Pris I don't write setter functions.
 
lol save a variable and care about performance
in fact, just lol setter function
 
5:13 PM
too slow
 
@Puppy Hold on. If unsigned overflow is declared UB by standard, then this does not make sane unsigned integer arithmetic mandatory on a standard-conforming implementation. I know that this is nitpickerish, but still....
 
@Pris lol those fucking microoptimizations
 
2 mins ago, by Puppy
I merely said that the user should be able to opt for UB.
2 mins ago, by Puppy
not that it should be the default.
 
@LightnessRacesinOrbit I take ignoring the context I made an effort to establish as "I want to discuss something else". You can complain that I failed in establishing that, and maybe you're right. But in the end I don't want to discuss modular arithmetic because 1) it's not the common case and 2) it's not interesting as the choice between signed and unsigned doesn't present itself in C++ for that case.
 
@Puppy Yeah, I must have misunderstood something.
 
5:14 PM
in fact, changing the default to be UB is pretty much just as bad as how we have now, since the user still doesn't have the option of picking the one he needs in the given situation.
 
@R.MartinhoFernandes Plonk for a few hours. I don't know whether you're having a bad time lately or something (and, if you are, I genuinely hope it gets resolved) but you've been acting kinda douchey lately.
 
@BartekBanachewicz its not a microopt its for my super special property class, I want move semantics if someone uses it with a fat type and said type is movable
 
user1804599
@Puppy does Wide have much UB
 
@Pris taking by value and moving preserves move semantics
 
void setThing(Thing thing) { m_thing = std::move(thing); }
 
5:16 PM
yep.
 
@Puppy How do you just "pick" behavior? (I'm starting to believe that I'm too moronic for this conversation)
 
Okay, thanks.
 
just for the love of god don't use this silly m_prefix
we aren't in 90s anymore
 
What? The m_ prefix is god like
What do you propose
 
No prefix for public members.
_ for private members.
 
5:17 PM
@Pris if by "god-like" you mean "stupid convention followed by the masses" you're absolutely right
 
@BartekBanachewicz I'll agree with you on that one
 
^ is what I use personally.
 
Oh, no.
 
@Griwes I don't like that :\
 
@thecoshman Why?
 
user1804599
5:17 PM
I don't use any prefix.
 
isn't leading underscore reserved?
 
It's far better than foo_ some people seem to be doing... :D
 
@Griwes why do it?
 
Underscores as a prefix in human code is a no no for me.
 
@Pris Only in global namespace.
 
user1804599
5:17 PM
I use a _ suffix, and only if there'd otherwise be a conflict with another member.
 
@Griwes also no if it's followed by a small letter, no?
 
@райтфолд People read code left to right though, putting it at the end is silly
 
@BartekBanachewicz _foo is reserved in global namespace. __foo and _Foo are reserved everywhere.
@thecoshman It's convenient.
 
anyway you already know my opinion about private members
they shouldn
5
 
They shouldn.
 
user1804599
5:19 PM
Alright, time to implement if expressions.
 
Dafuq
handle& handle::operator=(factory&& f)
{
    this->~handle();   // noexcept
    new (this) handle; // set into default state in case next line throws
    new (this) handle(std::move(f)); // might throw
    return *this;
}
Q_Q
 
@Columbo Simple example: just call a different function.
 
It's like ThePhD did this.
2
 
@R.MartinhoFernandes I am not convinced.
 
5:19 PM
The only time I've seen a destructor manually called is for like... placement new
 
@Puppy I meant core language behavior. I.e. from "builtin operators". Sure, I can change function calls, or the behaviors of functions.
 
@R.MartinhoFernandes That looks like a slide from one of the talks I've decided not to watch after seeing several slides...
What was it...
 
@Puppy It's more about performance. Unsigned integer arithmetic that is portable, allows overflows and is efficient, i.e. using actual machine instructions?
 
@wilx Well convince me then: what benefit do you take from overflow being well-defined?
 
@R.MartinhoFernandes The first two lines look okay, the third one seems incorrect though
 
5:21 PM
@R.MartinhoFernandes Because no daemons will fly out of my nose!
 
@R.MartinhoFernandes Out of curiosity is the type used as a base type?
 
@Columbo Allowing UB or overflow from builtin operators is dumb, they should clearly throw or something if over or underflow occurs.
 
@R.MartinhoFernandes (One message above yours)
 
@Columbo lol "er mah gerd the performances".
never heard of compiler intrinsics?
 
@wilx Are you claiming your program will work properly using the wrapped-around result from an overflow?
 
5:22 PM
@Puppy ... and that's portable, yeah?
 
...
 
@Feeds Eggs?
 
@wilx Because if it doesn't, that just sounds like dogma.
 
@Columbo They are if the Standard makes you offer one and gives it a name.
just like sin, cos, etc.
 
Xeo
Let's take a vote here: Do you consider the output of this programm garbage?
 
5:23 PM
@Columbo UB enables more performance (well at least as much) than whatever you have in the hardware..
 
@Puppy Ahhh, so you're saying we should introduce stdlib-functions that provide unsigned integer arithmetic with sane overflows?
 
@Columbo Proof: using whatever you think is the fastest possible is allowed under UB. Using something faster is also allowed.
 
@R.MartinhoFernandes I meant this, slide 39.
 
@R.MartinhoFernandes I am just saying that choosing unsigned types some points where UB could be had which seems like a good thing. And you are not making a good case for choosing signed types instead.
 
@wilx I think you missed a verb.
 
5:27 PM
@R.MartinhoFernandes: Let's try this. What do you gain from getting -1 out of 1-2 when the result is expected to be positive?
 
@wilx Why is the fact that 1-2 works not a good case?
@wilx You can test it, for one thing.
@wilx Because let's face it, if that happens, neither type will produce a good result (the bug is elsewhere). One of them enables you to write an assertion, though.
 
@Puppy yaay!
 
@R.MartinhoFernandes With unsigned types you can test 1 > 2 before doing the subtraction instead. Checking preconditions seem better than trying to diagnose the error after.
 
user1804599
oh boy
 
user1804599
codegen_if_expr
 
user1804599
5:29 PM
now I need to implement labels
 
@melak47 well, it seems you finally got it linking :)
 
@melak47 According to the LLVM devs, there's nothing special about regular main, you can just export it directly.
I also used to have a trampoline but dropped it.
 
@wilx So you prefer unsigned because you do those tests?
(Yes, I write assert(x >= 0); often)
 
@Puppy but then I have to figure out how to create (got this part) and set an int so I can return an int from it :s
 
5:33 PM
fucking shit
this thing doesn't generalize to more functions
 
@Griwes american "Science"
 
I'm basically reimplementing vtables
 
@R.MartinhoFernandes Well, yes. I mean, it is usually indexes to something, that are unsigned types. So, yes, I check the index or inputs that compute the index, if they make sense.
 
I can hold the state in a function closure, but it's impossible to have more functions this way
 
@melak47 You don't need to be able to set the int anywhere to return it.
you can just return it directly.
 
5:34 PM
the only thing I can store is a neigh fully applied operation
 
At least the good thing about this broken strong_typedef is that it made the unsigned non-sense not compile.
 
and that's it
 
irbuilder.CreateRet(irbuilder.getInt32(0)) or so
 
i just don't get it.
maybe I should just share a fucking IORef
:/
the obvious problem is that one function call would need to update closures of others
fucking OOP nonsense grgh
 
@Puppy ah, like say builder.CreateRet(builder.getInt32(0)); ?
 
5:40 PM
@LucDanton No.
 
dang, no stealth UB
 
It's still horrible.
I don't get it.
 
plain horrible, not signed stealth horrible though
 
This is supposed to be the result of a refactoring that took a long time :(
 
It took a lot of alcohol too
 
5:45 PM
I actually appreciate that Java has no unsigned types.
 
Everything is over-engineered, full of genericity that will never be benefited from since the possibilities form small closed sets, SRP violations, too much TMP (can't sneeze at it or VS will throw a fit) for something that almost doesn't need templates at all, ...
 
Unsigned types are useful for bitshifting stuff
 
We'll need a long meeting when he comes back from vacation.
 
C++ rules for intermingling unsigned and signed are too damn complicated.
 
Have any of you used CLion with Catch or VS (github.com/philsquared/Catch) before?
 
5:46 PM
C++ rules for anything are too damn complicated
@R.MartinhoFernandes Hey maybe you'll drop VS support :v
 
@milleniumbug eh.. sadly I don't think they get better anywhere else last I looked
 
Catch's macro magic seems to kill syntax highlighting in QtCreator... was wondering if that happens in VS or CLion as well
 
Xeo
@CatPlusPlus After he fought so hard to add it?
 
He did?
 
@Mgetz I think C#'s rules are the best defaults. Unsigneds get implicitly promoted to the next larger signed ideone.com/yTuDxe, but signeds don't get implicitly converted to unsigned at all ideone.com/I6jXfX.
 
5:53 PM
@R.MartinhoFernandes Nice.
 
user1804599
I should write an assembly printer.
 
user1804599
Reading bytecode with a hexeditor is not fun
 
@райтфолд you mean a Disassembler?
 
user1804599
Yes.
 
@Mgetz And if it's a compile-time constant, the compiler will convert it if not lossy, and error out if lossy, so you can convert an int constant 1000 to uint fine, but it won't convert to byte unless made explicit.
 
5:55 PM
shit I never remember the existential quantification syntax in type family instances
 
user1804599
Yay, compilation of if expressions works!
 

« first day (1627 days earlier)      last day (3323 days later) »