« first day (1265 days earlier)      last day (3698 days later) » 

11:00 PM
Can't remember what the old one was
 
I'll state again: C++ done fucked up
they should've made noexcept a property everything has, unless it throws or calls something that throws
 
@LightnessRacesinOrbit isn't the chat one, the old one?
 
idk, i only see performance gains in noexcept move constructors/move assignment/swap, I have yet to see a compiler optimization coming from it
 
the compilers have barely finished implementing noexcept at the semantic level.
 
since those come from algorithmic optimizations within the lib
using it in generic code is a pain in the ass
 
11:01 PM
the code generation improvements will take years to filter through.
hell, they're still implementing codegen improvements for RVO and NRVO.
 
so i'd rather wait for noexcept(auto)
still, right now, noexcept, and conditionally noexcept, add clutter for no gain
you might have a gain in the future
 
I understand that a clean exception specification mechanism in C++ is a mirage, correct?
 
but that is what they said about throw()
 
@Jefffrey ah, yes, probably
 
so yeah, use noexcept where it delivers (which is almost nowhere)
 
11:03 PM
the thing about that is
when you don't use noexcept you are forever forbidding people from using these functions in a noexcept function.
 
no
 
it's kinda like not marking shit const that should be.
 
noexcept is not transitive
 
er, it pretty much is transitive.
 
no
 
11:04 PM
you are only noexcept if you don't throw and if everybody you call doesn't throw.
 
yes, but that does not mean that you are noexcept(true)
it might just mean that within the context of some function, some other functions that can throw won't
 
er, if you don't throw and everybody you call doesn't throw, then you are noexcept, and writing it is just telling the compiler that fact.
 
well the compiler should type-check it
like const
 
I kinda disagree
const is enough arsing around already.
 
everything can throw
 
11:05 PM
not to mention the backwards compat angle.
@gnzlbg Er, many things cannot throw.
 
std::plus is noexcept(false)
its retarded
 
the Standard library has a pretty insane exception spec rule.
on this, we agree.
 
if some things throw, is sometimes implementation defined
QoI
so if i write a function noexcept
i want the compiler to make sure std::terminate won't be called
i.e. check that anything i call from there is noexcept too
otherwise, you are just inserting random std::terminates
in a large project with lots of developers it is like
 
eh, that would be too much of a backwards compatibility problem.
 
your interface function is noexcept
i dont trust you, and if something bad happens i'd rather try to recover
so do you have a throwing alternative?
 
11:08 PM
doesn't mean the implementation won't need to use legacy functions that don't throw but aren't marked noexcept.
@gnzlbg An exception leaking from a noexcept function is not "something bad".
it's "fundamentally broken".
 
so i would go as far as to recommend do not make your interfaces noexcept unless you are 100% sure that std::terminate won't be called
 
just as broken as trying to de-reference NULL.
 
yeah, but in a big project
you don't get the type-system to help you there
 
in any size project
if you write broken code, you have to deal with the fact that your code is broken.
noexcept has nothing new to add to this.
 
if it were an exception, you might be able to do something about it in a higher level
 
11:10 PM
not for this.
 
with noexcept, someone screws up, your hole system goes down, even if you can recover
and since the type-checker doesnt enforce it, people will do screw up
 
protecting against things as bad as this entails interprocess isolation.
and that's not new for noexcept.
 
no
type-system
 
has nothing to offer here.
 
that would have been enough
 
11:11 PM
backwards compat prevents any kind of checking like that.
 
if you do call nothing that can throw, then std::terminate won't be called
 
frankly
 
idk
like i used to use noexcept a lot
 
if an exception leaks out of a noexcept function you got bigger problems to worry about.
 
backward compatibility is a problem only if you fucked up in the past
 
11:12 PM
right now i just dont see the gain
 
er, no.
 
what is it? it is not performance (except for those three functions)
 
backward compat is useful for whenever you deal with code where whoever wrote it did not meet your current standards of coding; for any reason.
 
@gnzlbg those three functions are important in "the ecosystem"
 
i know
 
11:13 PM
am I having a dejavu?
 
but then, i dont make them noexcept
i static_assert that they are noexcept,
 
hope you don't ever use a class where, say, some prick didn't mark it noexcept because he didn't see the gain.
 
imo even making those three crucial functions noexcept is wrong
 
thought I ran out of coffee, but remembered I bought some yesterday ...
 
yeah, cause the speed and correctness improvements of being able to move are totally unimportant.
 
11:14 PM
i think the right thing to do is static_assert that they are noexcept, and if they arent, try to fix that
 
std::vector<std::unique_ptr<T>>? who needs it!
 
there is a difference between making it noexcept, and it being noexcept
 
@DeadMG anyone that wants to hold ownership of an arbitrary amount of objects?
 
they should be noexcept, but you shouldnt want to force them to be,
 
@nightcracker it was sarcastic I believe
 
11:15 PM
if they arent, it is because your class contains a member that doesnt have noexcept move constructor
 
@gnzlbg Or because you want to call some other function that is not noexcept.
 
or some other issue like that
 
case in point: std::map, where some implementations wanted to allocate memory for some reason in the move constructor.
 
well, the you make them noexcept, but not by rule
 
well, you can only do that if everybody in the chain accurately noexcepted every function they use.
 
11:17 PM
i found errors by statically asserting that the compiler generated ones where noexcept
and in the cases in which they werent, figuring out why, most of the time, the errors didnt have anything to do with my type at all, and in one case
they where using an operation that could throw
 
man, C++ seems like a scary beast
 
so if i make them noexcept, yes i get the strong-exception safety guarantee with "performance"
 
it is
 
or at least that's the impression I get every time people start talking about it here lol
 
until.... std::terminate is randomly called
 
11:18 PM
eh
 
...
@AlexM. it's worse
 
@AlexM. C++ is like a chainsaw - very efficient and useful if handled expertly.
 
having std::terminate be called is the least of your worries if an exception leaks from a noexcept function.
 
yeah, my worry is having std::terminate be called because someone decided move operations must always be marked noexcept even when they can do things that can throw
 
if you use noexcept when you shouldn't, bad things happen
no shit
 
11:20 PM
idk, i like performance, and i use noexcept when i find it fit
but even for the three things that should be noexcept, is not a rule
i could understand using it to catch errors when exceptions are thrown, if you really expected none, and std::terminate is called, someone screw up
 
there are a few things I'd change about noexcept if I could.
 
but thats more of an "assert_noexcept" kind of scenario
functions throw, exceptions propagate, std::terminate being called because some moron decided to make some function in the chain noexcept due to "performance" that is not delivered is like..
better not use it
unless you really really know what you are doing
 
then don't call any function, ever.
they could de-reference NULL!
 
yes, but scott is not suggesting "dereference NULL!!! is good for performance and everybody likes performance"
 
I'm with the puppy here. Using noexcept is not undefined behaviour either
 
11:25 PM
people do lots of stupid things in for imagined performance gains.
I don't see how there being a real performance gain makes any difference.
 
yes but noexcept does not deliver
unless for move constr/assignment/swap
so dont tell everybody to use it everywhere
if you dont get anything in return
people will just write it without thinking
 
1
A: Handling exceptions of overridden methods from the base class in C++

James McNellis What if the user provides his own plugin but his code throws an unhanded exception? This will make the application to crash and the server will go offline. If the user-provided plugin throws an exception that is not allowed by the plugin specification, then that is a logic error in the user-...

 
with const is ok, because the compiler will tell them if they screw up
with noexcept they just dont realize it
and then its an interface contract
you cant go back
 
they will realize it sooner!
^ half j/k
 
i see your point
but i still think that from the advice most people will think "if it makes my code faster, lets put it everywhere until i realize it"
which is the opposite mindset of "everything can throw"
 
11:28 PM
> If plugins must not throw exceptions, declare the virtual function as noexcept in the base class. This will require all overrides in derived classes to be noexcept as well. If an override fails to handle an exception and that exception leaks across the noexcept boundary, std::terminate() will be called, terminating execution. If you need to be able to restart the service on termination, consider using a watchdog process that monitors the service.
 
frankly
if they mark their function noexcept, and they don't know it doesn't throw, then you're back to "Morons could write bad code", which is not new and far from unique to noexcept.
 
@sehe thats cool!
 
@gnzlbg it's the same topic from that linked answer
@gnzlbg the point is, you can't protect against all evils so that's not by any measure a reason to stay away from noexcept.
 
so at least it is transitive in that context
that is good
 
guys
 
11:29 PM
You can name a hundred reasons to not use it, but the risk isn't one of them
 
did the font of wikipedia change for you as well?
 
no idea.
 
i named no performance gain in most cases, verbose in normal code, extremely verbose in generic code, doesnt play well with the std library in generic code,
(i.e. most of the stuff in <functional> is noexcept(false), no one writes lambdas with noexcept, and std::function is noexcept(false) so Predicates/Functors are almost always noexcept false..)
 
I think those are some good reasons. YAGNI might apply. However, if you are going to write heavy-duty library code, please use it where ever possible. More like: exception-aware coding than "~~purformance~~"
 
and then my last point is that in interfaces, if you throw i might be able to do something about it, if you call std::terminate i cannot
 
11:33 PM
purrformance
 
so... becareful
 
Cat Plus Plus loves purrformance
 
@gnzlbg if you call std::terminate, nobody can help it. with or without noexcept
 
@sehe without noexcept(auto) it is a real pain to write noexcept "transparent" generic code
like the RETURNS macro works for one-liners
 
I know. I wasn't asking
 
11:34 PM
but for the rest... its like... kill me
:/
so my moral is, it would be nice
 
@gnzlbg I bet some people say the same about const, volatile
 
but right now, it doesnt provide you much, and is a pain
 
I do say the same about const.
 
volatile?
I only use that while debugging/profiling =/
 
@gnzlbg s/noexcept/c++/
 
11:35 PM
I guess some people use it for embedded stuff
 
so i rather use it sparingly well the return on investment is high (e.g. move constructor/assignment/swap and few other places: some interface function where it makes sense)
 
s/well/where/?
 
i dont see the problem with const
i use const everywhere and const overloading quite a bit
 
@gnzlbg so the point seems to be, you can only think of it this way, because library implementers didn't use it sparingly. So, there's the division again
 
it gets you even less than noexcept.
considerably less.
and is considerably more arsing around.
 
11:37 PM
it gets me type safety
makes sure i dont screw up
 
ok hold that thought about const
 
it is transitive for all functions
 
now think about exception safety
 
wrong. type safety gets you const checking
 
and if you want to do something unsafe, you still can
but you are explicit
 
11:37 PM
there are not many places where a const correctness violation actually results in a problem.
the only one offhand is map keys.
 
@DeadMG one of those places is my mind
it helps me reason about my programs, to know where i have sideeffects
where am I threadsafe
 
where am I exception-safe?
 
whoah, whoah.
 
god if only there was this feature..
 
where can exceptions legally be thrown...
 
11:38 PM
you didn't really just equate constness and thread safety, did you?
 
if i do a const cast, std::terminate is not called :/
 
why are you doing a const cast?
 
so there is a difference of a compile-time error and a run-time one
 
that's the problem
 
if noexcept would give me a compile-time error
i would have no problem with it at all
since it would be just like const
and no one could screw up
 
11:40 PM
so the question is, why doesn't it?
 
but it isnt so it is not like const at all except in virtual functions
 
because C++ done fucked up
 
which i learned thanks to @sehe today and I find it really cool
@nightcracker so yes, god if only there was this feature for type-safe exception checking at compile time, just like const...
 
void foo(int& a, int const& b) { int c = b; a+=3; assert(b==c); } int i = 42; foo(i, i); - where's your compile time safety?
 
i was talking about const function qualifiers
but yeah a const reference is just that
still const qualifiers kind of suck a bit in C++11
since the moment you do &/&& overloading
you have to also do const& overloading -.0
-.-
 
11:44 PM
inb4 we need to have deduced template arguments for the implicit this parameter
 
so i end up sometimes with A::foo() &; A::foo() &&; A::foo() const&
 
see, const isn't verbose, like noexcept :) It basically duplicates 80% of readonly code. For no gain
 
we should all just use dump static typing
 
Why can't c++ work it out.
 
personally I like random typing
 
11:45 PM
well you can implement only the const function
 
Oh wait, maybe it can't for the same reason it can't statically check noexcept
 
and const_cast this inside the non const function
or the other way around
 
@sehe why not (noexcept mostly)?
 
so the function dupplication stuff, you dont need it
but it is ugly to have to declare it
 
@gnzlbg cough. You can't call anything in a function you don't implement
 
11:46 PM
yep
but you can implement it once, and call it from the other one
no need to implement it twice
although for short functions, the const_cast is too painful
so your point holds :/
it sucks
 
I know what you mean. But in my code 90% of these are 3-line functions, so relaying it with const_casts is not a gain
 
yes i know
in my code too :(
i hate it in begin() end()
is like.. damn youu compiler!
damn youu standard comittee!
i hope noexcept(auto) makes writing generic code more pleasant
 
I don't implement begin() and end() that often. And I'll usually use free functions for that anyways. So, I can deduce the types. C++1y FTW
 
:D
 
C++1y?
 
11:49 PM
why not C++11?
 
is that like 14?
 
c++yesno
 
or 13.5?
C++--
 
@gnzlbg less syntactic sugar, remember
 
but...
 
11:49 PM
14 mins ago, by gnzlbg
like the RETURNS macro works for one-liners
 
C*=1
 
if @sehe, if you want those free functions to be noexcept correct... you still have to write something at the end :/
 
you nor I were talking about noexcept there
 
i found that auto return type sucks, since it doesnt deduce noexcept, so instead of having a macro for filling up noexcept + decltype, the macro only fills up noexcept...
but then you cannot sfinae inside noexcept
so the macro is not equivalent
 
newsflash: C++ sucks
 
11:51 PM
so you dont use auto return type but use the macro with decltype
me lost all faith on humanity :(
cant we get one c++ feature right?
 
@gnzlbg you had faith in humanity?
 
I don't. I just type the stuff. And it hardly ever leads to unmaintainable code. I'm not a library buff and the worst collisions of language hardships can usually be easily avoided.
@gnzlbg the fundamental language is flawed, how could it be done right. Haskell tried
 
haskell sucks too
rust sucks too
 
> "Haskell tried"
Humans suck, Gödel sucks the most.
 
let's all blame Gödel
 
11:54 PM
i want a haskell with eager evaluation, no gc, and array based instead of list based, and with better metaprogramming, and variadics, and candy
 
Give me my Hilbert back.
 
either your programming language sucks or produces wrong results
 
rust looks nice, might get better, but no HKT, no variadics, no UFCS, no CTFE,..
 
make your own damned language then
 
by the moment they add those they will have a backwards compatibility issue
no, I like complaining while watching tv, doing stuff is stressing, people like me will always complain that whatever you do is not good enough
 
11:56 PM
@gnzlbg I like how these abbrevs mean nothing to me
 
honestly, the engineering world would be a lot better if languages had a non-backwards-compatible patch every 5 years or so
 
HKT: higher-kinded types: like template template parameters
UFCS uniform function call syntax, like extension methods
CTFE compile-time function evaluation: like constexpr
 
it's templates all the way down!
 
@nightcracker they do. That's when java begets c#, and c# begets f#, when Python begets (Boo, Python3) etc.
@gnzlbg ok
@gnzlbg ok
@gnzlbg check :)
 
sorry for the abbrevs
:/
 
11:57 PM
no imagine if the C++ committee was allowed to drop backwards compatability for C++2x
 
What's your day job, since you're wielding these jargon files pretty daftly?
 
so much bullshit can be dropped
 
yes, like: market share, compiler vendor support
 
@sehe research assistant/scientist at a university
 
I figured. Good stuff. I like this room.
 
11:58 PM
what field?
 
@nightcracker aerodynamics
 
nice
 
Sadly - the time is there that the eyelids increasing tend towards the earth's core
 
complicated stuff =/
 
I'll have to say good night
 
11:59 PM
good night! im going to sleep too i guess
 

« first day (1265 days earlier)      last day (3698 days later) »