« first day (1013 days earlier)      last day (3927 days later) » 

5:01 PM
@EiyrioüvonKauyf you see, you don't belong. Our you'd understand. No sane person can doc++
 
@Rapptz No good answer
 
@KonradRudolph Only one in SO.
 
@Rapptz No, definitely not – I remember several benchmarks, although those were probably all on formatted output
 
For up to C++11, you can use my above union trick to be free of aliasing issues: union A { float x; int32_t y; }; int32_t value = A{3.14f}.y; (I don't really think that this is anymore safer than doing it without the temporary :D). The reason this "works" is that the initializer is a prvalue and hence is free of the aliasing rule restrictions. This however will change in C++14 because the initializer will be an xvalue :) — Johannes Schaub - litb yesterday
^^ Union type-punning: The biggest unsolved problem in C++.
2
 
5:03 PM
@MooingDuck lmgtfy.com/?q=nvi+c%2B%2B&l=1 I'm on tablet, this is quickest
 
@KonradRudolph My keywords were FILE* and fstream. The other two I found were uninteresting with less votes, the other was an opinion on whether you use C I/O or C++ I/O.
 
@Rapptz Unfortunately I really have no time to investigate that now but I guess a better search term would be “printf”
 
printf is faster than std::cout until you turn off syncing though
then they're about the same I guess
 
@Rapptz Which, to be fair, is utterly irrelevant. Of course it’s faster if you do an unfair comparison
 
Does anyone here have a subscription to Safari?
 
5:08 PM
@Rapptz MSVC's cout uses printf for some things
 
@MooingDuck lol..
 
gawd my terrible answer was accepted
 
hmm how can i check for memory corruption in a segment ...? e.g. if a program crashes part way through a read/write operation; how can i check what part of the memory is still valid and rebuild the structure as much as i can
 
what
by writing code that doesn't manipulate memory directly would be a good start.
@EiyrioüvonKauyf it's not "crash" then
 
i mean crash
like if the whole system power cycles
 
5:14 PM
crash is when you are kicked in the butt by your OS for bad behaviour
 
oh shit uhhh what do i call that then
 
@EiyrioüvonKauyf You can't. If your application encounters a terminating error, like using bad memory, then it's entire state is unusable.
 
@EiyrioüvonKauyf i have no idea what you mean, so I can't help you there
 
@DeadMG no if the system my application is running on restarts spontaneously - anyway to 'resume' operation using old data. e.g. pre-restart data
 
@EiyrioüvonKauyf Then how would you possibly gain access to your old data? All state you haven't written to disk is lost.
 
5:16 PM
hmm ok if my program crashes
 
anyway, even if you had all the state, restoring as much as you can would be an incredibly application-specific thing, and not at all suited to a general question.
 
and on that note, you should seriously stop asking random questions that nobody could possibly answer.
 
google time :3
 
@EiyrioüvonKauyf Auto save.
 
@EiyrioüvonKauyf please google before you ask a dumb question next time
2
 
@EtiennedeMartel autosave for an executable? i wish
@BartekBanachewicz I have; i mean time to look at what other languages/program do. I was looking for a C++ solution / idea / possibility rather than baking a new one
 
user142019
Morning.
 
5:17 PM
@rightfold hi there
 
@EiyrioüvonKauyf Language is irrelevant and the other programs will employ program-specific solutions.
 
user142019
How's life.
 
@rightfold Hello, Horny Pony.
 
@rightfold Octree.
 
@EiyrioüvonKauyf @BartekBanachewicz yes I am a french person
 
5:18 PM
@kbok :D I knew you'd find it funny
 
@EiyrioüvonKauyf sure, every once in a while, save the state of the program. When you close properly, delete it all. When you launch, if the state exists, load it and resume. There's nothing automatic.
 
@EiyrioüvonKauyf I mean, persist your state regularly.
 
@EiyrioüvonKauyf Actually, almost, yes
 
user142019
@MonadNewb hi babe
 
@EtiennedeMartel ... how on earth do i persist my state regularly when i have a bazillion threads ... how do i do this anyway. what should i google for?
 
5:19 PM
I should write Direct-Illumination Voxel-Octree-Based renderer
@EiyrioüvonKauyf "high availability applications in C++"
 
@BartekBanachewicz that is fundamentally different
 
and before you even start: it's hard.
@EiyrioüvonKauyf no, that's exactly the same
at least concepts are.
 
high availability != persistant storage
 
please, just go google
and leave this room for a while, mmkay
 
5:21 PM
come back when you have an idea of what you are talking about.
 
^ then you should come with me if that's why
 
I have written a system like this.
It's on my github.
It was part of my job.
I did a few months of research for it.
 
TIL distance to the moon ~= 1 light-second
 
@EiyrioüvonKauyf That's up to you, we can't answer that.
 
@kbok that's still a kinda bad ping :/
 
5:23 PM
@EiyrioüvonKauyf persistant storage is part of high availability
 
you've written a persistent multi-threaded system extensively using shared memory that can completely restart on crash. haha right
@MooingDuck part . of a high availability app.
 
@BartekBanachewicz Yeah. No counter-strike for moon colonists
 
1 min ago, by Bartek Banachewicz
It's on my github.
 
@rightfold shh...I told you to keep that to yourself.
 
@EiyrioüvonKauyf it's the part we're talking about
 
5:23 PM
And I didn't say it's "extensively using shared memory" or "multi-threaded"
 
user142019
@MonadNewb okay babe
 
@BartekBanachewicz github.com/bananu7?tab=repositories ? see it i don't
 
@rightfold so how goes the Java?
 
user142019
What Java?
 
user142019
I'm not using Java thank God.
 
5:24 PM
any Java
=p
 
@BartekBanachewicz that's different then; i can just make a state object and write it to file; that's easy
 
@EiyrioüvonKauyf stop being so aggressive
3
 
@rightfold what project are you working on recently?
 
@MooingDuck to you: sorry about that; to bartek i'm good
 
@EiyrioüvonKauyf fuck if I care if you see it? You apparently know better.
 
user142019
5:25 PM
@MonadNewb Well, Java still lacks lambdas, lack of checked exceptions and type inference for local variables, so yeah it's still horrifically terrible.
 
I hear lambdas are being considered for Java 8.
 
user142019
Java ≠ Java 8.
 
@rightfold unfortunately
 
user142019
Java 8 is probably reasonable if used with Lombok.
 
user142019
Otherwise no gtfo.
 
5:28 PM
Why am I receiving notifications for commits in my repo Oo
 
I swear PEP8 with its retarded argument=value needs to die.
 
user142019
Why?
 
user142019
Lack of spaces? I like that.
 
Guys, what do you think of getters returning const std::string &
 
@kbok excellent. Why?
 
user142019
5:30 PM
@kbok What else would you do?
 
Just return a value.
 
or return a * :3. just break all object oriented ness
 
user142019
inb4 out parameter
inb4 pointer
 
@kbok pretty ok.
 
@rightfold beat you to it
 
5:31 PM
Just a value
 
somehow it's always faster to write a reply that's not good than the one that's good.
 
@rightfold what... pulling a pink Floyd is valid
 
user142019
What?
 
sorry bad joke on "In through the out door"
 
There's this one guy at work who wants to make "return std::string const &" a hard rule and I think it's dumb
 
5:32 PM
~~~performance~~~
 
how do you return failures then?
 
this ^
 
You don't return failures. Throw.
 
ouch
 
he's all like "let's measure and you'll see"
 
5:33 PM
did you measure?
 
I mean you could return optional or either, but that's a pain to handle in C++.
 
@kbok not a hard rule, but it does prevent useless copies
 
no, this is not relevant
 
Just throw.
 
@CatPlusPlus I hope your code has a very very happy path, because exceptions are never cheap
 
5:34 PM
@Mgetz relevant benchmarks or GTFO
 
1 min ago, by Cat Plus Plus
~~~performance~~~
 
@Mgetz they're a lot cheaper than checking for error codes properly
 
fuck premature optimizations forever
fuck people doing them
 
Exceptions are zero-cost until thrown.
 
fuck people spreading FUD without measuring
 
5:35 PM
When you're doing for instance a SQL request on the network, this one 5-char string copy is totally unimportant
 
wow.... I didn't say don't use exceptions
 
Also always :laffo: at ~performance~ over correctness and sensible semantics.
 
I just winced at them being used for business
 
statements like this are then repeated by idiots
 
user142019
@Mgetz NOOOOOO! A NANOSECOND!
 
5:35 PM
someone is mad~
 
@Mgetz yes, but there's no reason to wince. There's every reason to wince at not using them for business
 
Low level savages.
 
and then one day you go to a workplace where they're forbidden
 
@CatPlusPlus Exactly. The're called 'exceptions'. That means they only happen under exceptional circumstances. That means it does not matter much if they are a bit costly.
 
We have SQL queries than go on for minutes before they're over so seriously string copy is not an issue
 
user142019
5:36 PM
 
user142019
WTF you stupid highlighting plug-in this isn't a syntax error.
 
I cringe at the "exceptional circumstances" reasoning, because it then leads to bickering over whether errors are exceptional or not.
 
@kbok do you have any idea why the room topic is croissants .....?
 
It's a flow interrupt tool.
 
@Mgetz The only reason not to use exceptions I can think of is if you're developing for an embedded development that can't afford the space for zero cost exceptions.
 
5:36 PM
@EiyrioüvonKauyf there was a Q about them today
 
Failure requires a flow interrupt.
Doesn't get much simpler.
 
because you asked
 
Sorry to barge right in, but I'm just curious if anyone knows whether Visual Studio can be installed on a drive separate from the Windows 8 drive?
 
but that really isn't why I have an aversion
 
Large part of VS is shared components which will end up in Program Files no matter what.
 
5:37 PM
> throwing an exception up 1000 stack levels
 
~~~~~performance~~~~~
 
@刘哲诚 No, it won't let you choose
 
C++ programmers will never cease to be funny.
 
honestly my objection is on the grounds that you should only use exceptions for .... LE GASP something exceptional
 
@EiyrioüvonKauyf Yeah - the question came up on chat and then we all went out for croissants. I ate all my chocolate ones and now I want more. I'm going to Tesco later.
 
5:38 PM
Failure is exceptional.
 
if you're expecting that something might fail.... it's not exceptional
 
fml. So that means I have to allocate enough space for both W8 and VS12 when I install OS..
 
2 mins ago, by Cat Plus Plus
I cringe at the "exceptional circumstances" reasoning, because it then leads to bickering over whether errors are exceptional or not.
 
@Mgetz everything might fail
@CatPlusPlus saw that coming
 
user142019
@Mgetz It is.
 
5:39 PM
Exceptions are a control flow mechanism.
 
It's FUD if you say the cost of exceptions is "very significant" without knowing what percentage slower an actual app will run as a consequence of using them. Sometimes it's significant, usually it isn't. And you can't use "it would break a realtime app" as a reason not to use a particular language feature, since (a) almost all apps are not realtime, and (b) almost all language features could break a realtime app, by making it impossible to predict cache misses and whatnot. — Steve Jessop Jun 19 '09 at 18:43
 
@BartekBanachewicz please don't put words in my mouth
 
@Bill: s/in Java/EVER/ They're called "exceptions" for a reason; they're exceptional. — Pesto Jun 19 '09 at 16:23
:cripes:
 
my objection to exceptions is philisophical
 
Which makes it even dumber.
 
5:40 PM
@Mgetz you arguments about "exceptionality" don't really make sense, sorry
every time you write throw, you expect something bad.
 
user142019
Everything not on the happy path is exceptional.
 
@Mgetz philosophical
lol the happy path
 
But guys guys manually propagating errors is SO MUCH BETTER
 
@Mgetz thus, by your logic, we should never use exceptions, because using them would imply we're expecting error in the place
 
All C programmers do it SO IT MUST BE GOOD RIGHT
 
5:41 PM
@BartekBanachewicz actually no
 
user142019
All C programmers use longjmp.
 
3 mins ago, by Mgetz
if you're expecting that something might fail.... it's not exceptional
 
It's not an error-prone boilerplate AT ALL!
 
user142019
Termination is best error handling.
 
user142019
Use Erlang and let it crash.
 
5:42 PM
@CatPlusPlus I cannot find much in 'Program Files'. 'C:\Program Files\Microsoft Visual Studio 10.0' has only 86.4KB.
 
@Mgetz please elaborate then, because none of us understood what you really meant
 
@MartinJames Common Files.
@rightfold Terminate bad programmers.
 
I'm of the group that says that exceptions should be used for validation and exceptional cases of failure (things that would corrupt state)
e.g. if you run into them in production it's a bad thing
 
@Mgetz can you show me an example of a failure that doesn't corrupt state?
 
user142019
You're of the terrible group.
2
 
5:43 PM
No.
 
@CatPlusPlus Oh - 199MB :(
 
Jesus.
Ugh.
@MartinJames Also Visual Studio is 32-bit thing, so Program Files (x86)
 
@BartekBanachewicz corrupting state is highly unlikely, that would be an unrecoverable error
 
Hey hey hey guess what
Guess why you can catch exceptions
 
@CatPlusPlus I have 64-bit?
 
5:44 PM
because you didn't allocate the handler
 
Because it's a fucking recoverable flow interruption, that's why.
 
@CatPlusPlus I'm aware of catch blocks, but thank you
 
room topic changed to Lounge<C++>: Bad programmers makes me want to throw up; [c++] [c++11] [c++-faq] [no-helpdesk]
 
@Mgetz can you show me a real world example of failure that wouldn't corrupt state? You are going to handle it manually, as I understood. Then if you don't handle it, bad things happen. Then by one of your arguments we should use exceptions because state corruption, and by other we shouldn't, because we expect failure.
In other words, you simply contradict yourself.
 
@BartekBanachewicz socket fails to connect, state is not corrupted, just retry
 
5:46 PM
C:\Program Files (x86)\Microsoft Visual Studio 10.0 has 203MB.
 
And there's VS stuff in Common Files, too.
IOW it's a lost cause to try to install VS on non-system drive.
 
if your system is in a state that is intended then it's not corrupt, even if that state is one of failure
 
room topic changed to Lounge<C++>: Bad programmers make me want to throw up; [c++] [c++11] [c++-faq] [no-helpdesk]
 
@Mgetz in this case error resolution (retry) is in the same place as the call. What if you can't connect n times?
 
commit --amend, you haven't seen anything.
 
5:48 PM
Exceptions allow you to delegate error resolution to a place different from the error creation.
 
@BartekBanachewicz at that point it's the developers decision, is it failure enough to throw, maybe, maybe not, that would depend on context
 
This stupid trainwreck of a discussion is going nowhere, back to work.
 
C:\Program Files (x86)\Common Files\microsoft shared : 398MB :(
 
@DeadMG i like where this conversation just came to
 
@Mgetz if the error is going to be handled by a class different than the socket itself, there's no maybe: throw.
if you want someone else to handle the error, throw.
 
5:49 PM
wat?
why did you ping me.
 
@BartekBanachewicz but what are you throwing? if it's something specific to sockets then you're breaking separation of concerns
 
@Mgetz runtime_error is a simplest exception that's ok here.
or something deriving from it, obviously
 
@DeadMG look up; they're talking about corruption, lol; (not the exact same but still)
 
or boost exception if you use boost exceptions
 
what do I care what they're talking about?
I wish you would think that more often before speaking in this chat
 
5:51 PM
yeah, he seems to press keys without any consideration and it's annoying as fuck, especially when I get pinged 7 times by the same message
 
no, it isn't.
and even if it was
 
@BartekBanachewicz is that useful though? does it tell the handling code anything? not really, you would likely need to subclass to produce something more useful so the handling class.
 
I don't care.
 
@Mgetz or use boost exceptions
 
boost wraps sockets anyway doesn't it?
 
5:54 PM
3
 
@EiyrioüvonKauyf 8.3.2 References [dcl.ref]
@Mgetz um, well, I don't see how it's relevant, but yes
 
it's not which is why I didn't ping you
 
@CatPlusPlus amazing
 
I know right.
 
I'm trying to find a way to express my thoughts in something more coherent and useful than "Well... maybe"
 
5:59 PM
My 2 most common bugs the last couple of weeks:
(1) std::min(lower_bound, value);
(2) std::max(value, upper_bound);
 

« first day (1013 days earlier)      last day (3927 days later) »