« first day (1371 days earlier)      last day (3574 days later) » 

9:00 AM
@ThePhD That using shit is the best C# has to offer.
 
@ThePhD you're trying to write C++ in C# and that's what happens
well actually when you try to write C++ in C++ the very same happens so I am not sure why you are surprised
oh my fucking god
 
@ThePhD Are you actually trying to get deterministic destruction in C#...?
 
why do I ever bother opening reddit
> I think Java has a really sensible approach to that problem. Not just forbidding operator overloading, but forbidding free-standing functions also helps readability
 
user3010322
@ParkYoung-Bae Uh. A little.
 
@ThePhD :facepalm:
 
9:02 AM
if r/haskell has that bullshit then there's nothing left on reddit to read
 
> implying there was something to start with
 
user3010322
@ParkYoung-Bae It's not fully like that!
 
user3010322
I'm just, uh. Using Map from the GPU.
 
user3010322
So I have to Unmap after I'm done.
 
user3010322
If the Map call succeeds (i.e., doesn't throw), then I need to Unmap, come hell or high water.
 
9:04 AM
that's what finally block is for
 
^ this
 
user3010322
But what if an exception is throw and I only have try {} finally {} ?
 
user3010322
Can I throw; statement in the finally to say "If an exception happens, throw it again?"
 
finally is executed regardless
 
@ParkYoung-Bae what if the computer losses power?
 
9:06 AM
All hope is lost
 
user3010322
What if I return from inside the try{} ?
 
user3010322
Does finally always get executed?
 
What if you throw from the catch block?
 
@ParkYoung-Bae so then finally is not always executed! Y U LIE!
@rubenvb ... then some other try/catch block has to handle it.
 
@thecoshman but then finally is only executed if no rethrowing is involved...
 
9:08 AM
Throwing an exception from a catch block is not that uncommon, handy if you are writing an interface to many other interfaces, and want to provide consistent exceptions.
 
@rubenvb No, it runs.
 
@rubenvb no, your finally block is still executed
 
If, at some point, the exception is handled, the finally block will be run
If you don't catch it, then the program terminates
 
@ParkYoung-Bae "If, at some point, the try block is exited, (...)" FTFY
 
So finally is a lame excuse for broken RAII?
 
user3010322
9:09 AM
try { int blah = 0; /* ... */ if ( blah == 0 ) return; /* .... */ } finally { Critical.ReleaseOrMeltProcessor( ... ); }
 
@R.MartinhoFernandes Yes that's a better wording indeed
 
@ThePhD more or less...
 
user3010322
If blah == 0 and return is called, will Critical.ReleaseOrMeltProcessor get called?
 
finally is always run unless you kill the program altogether
 
user3010322
Oh. Well then, I can keep all my early returns then and remove some of this gnarly nesting.
 
9:11 AM
║║║║║████║║║████║████████║║║║███║█║║║║║║║
║║║║║████║║║████║████████║║║██████║║║║║║║
║║║║║║██║║║║║██║║║██║║║║██║██║║║██║║║║║║║
║║║║║║███║║║║█║║║║██║║║║██║██║║║██║║║║║║║
║║║║║║║██║║║██║║║║██║║║║║║║██║║║║█║║║║║║║
║║║║║║║███║║██║║║║██║║║║║║║███║║║█║║║║║║║
║║║║║║║███║██║║║║║██║║║██║║████║║║║║║║║║║
║║║║║║║║██║██║║║║║██║║║██║║║████║║║║║║║║║
║║║║║║║║████║║║║║║███████║║║█████║║║║║║║║
║║║║║║║║║███║║║║║║██║║║██║║║║█████║║║║║║║
║║║║║║║║║███║║║║║║██║║║██║║║║║║███║║║║║║║
║║║║║║║║║███║║║║║║██║║║║║║║█║║║║███║║║║║║
 
the try block is executed, if it throws a catch block can handle it. Either way, regardless of what returns/throws where ever, the finally block will walys be run.
 
user3010322
Kinky.
 
@ThePhD sure... but maybe you should be handling this differently...
try{ functionThatMightThrow(); } finally { cleanUpThatFunction(); } // maybe
that allows 'functionThatMightThorw' to just focus on doing it's work... bit risky as if you don't wrap it and perform the cleanUp, you're boned.
but then, you could do it via scope based magic... maybe...
 
I don't think I have used finally in C# outside of one or two building blocks.
 
user3010322
Well, I've got a bunch of places where I've got two-piece calls that need to ensure if one call succeeds, the other happens no matter what.
 
9:18 AM
Not loop advancement, I hope.
I just use using.
 
user3010322
It's a D3D11DeviceContext.Map call, with its friend Unmap.
 
user3010322
I do make_destructor( Unmap ) in C++, so I can just throw and let stack unwinding help me there.
 
Can i post a pastebin so one of you can tell me this code looks like shit? It's pretty short.
 
user3010322
You ask and then post it. Why did you ask?
 
user3010322
Can we have sex? Has sex.
 
9:20 AM
It's 5:30 and I can't think right?
 
It's 11:19.
 
You can't has sex....with weenie dog...
 
@R.MartinhoFernandes The timestamp in your message disagrees
 
Without going in depth tough. By looknig at taht code assde form the random vector shit i forgot to remove. does it look bad so far?
I'll submit it for review when it's done.
 
the overall formatting is dubious at best
 
9:22 AM
You should get a real name.
 
Yeah, the formatting is pretty fucked atm
Yeah i really should
I've been meaning to do that.
 
Nobody wants to read badly formatted code
 
while(!oss.eof()) is wrong.
You should throw away the book that taught you that.
 
I wasn't following a format when i wrote taht
Lol
 
"what book?"
 
9:23 AM
I jsut did it.
 
It's an unexplicable mystery, but somehow some people think that works.
It doesn't. It's just wrong.
 
I've read many books, but, i wasn't formatting :'(
 
The correct way to make a read loop is while(read_operation())
Everything else is either wrong (as is the case with !oss.eof()) or unnecessarily confusing.
 
I give this code 1.5/10
 
Confusing from formatting?
And i used that so it would stop at eof
but i get what you mean
 
9:25 AM
I stopped reading at s_input
 
it's still wrong
 
There is no commenting or anything so some of it I'd expect might seems weird.
 
@user2372903 But it doesn't. The way to stop at eof is while(read_operation()).
 
I se
 
while(!oss.eof()) stops one read after eof.
 
9:26 AM
well that's fair.
What do you think is confusing. because it's so damn ugly and doesn't explain itself?
bad var names and such?
 
user3010322
... Heh.
 
user3010322
Hehehehehe.
 
user3010322
Hehehehehehehehe.
 
lol
 
I don't know why people do while(!stream.eof())
 
user3010322
9:27 AM
while ( reader.read( my_optional ) )
 
It's wrong in C too.
 
It's always wrong. It makes no sense that people keep thinking it works.
 
user3010322
boolean return and out-params.
 
but it's meant to be c++
 
user3010322
The greatest. <3
 
9:28 AM
I don't see a problem returning a bool though.
 
(Ok, it's not always wrong. I can craft a loop where it works. However, it will be needlessly complicated.)
 
@R.MartinhoFernandes How about while (!stream.eof());
 
The eof stuff.
yeah I see what you're saying
Now
 
I'm almost done with this command line parser thing.
Maybe 8th time is the charm.
 
@Rapptz you mean Boost.Program_options?
 
9:31 AM
No.
 
lol no shit. :-p
 
Boost.Program_options is, for some god forsaken reason, not header-only.
 
I made a script that makes a single header version of my files
 
R#'s [NotNull] does nothing at runtime right?
 
9:33 AM
I finally got around to doing that which is neato
 
I stole it from Catch.
 
I wanna avoid #include <iostream> just to use std::cerr
I didn't like Catch's version
 
@Rapptz <iosfwd>?
 
doesn't help
 
Ah no, it doesn't. You're screwed.
 
9:34 AM
Is there something on nuget that does [NotNull] -> IL voodoo inserting validation?
 
Xeo
Can you use namespaces in extern declarations?
 
@JohanLarsson You'd need some kind of weaver, I guess.
 
Xeo
wait nvm, that would be stupid
@Rapptz Yeah sorry, they're only declared in there
 
p.parse(argc, argv, std::cout, std::cerr); looks bad.
:<
 
Xeo
and you can't forward-extern them without introducing UB
 
user3010322
9:36 AM
git rekt, scrub.
 
@R.MartinhoFernandes Yeah, feels like it should be stuff out there. Pretty common issue. Could roll my own for fun though.
 
@Rapptz default arguments?
 
@ThePhD shh
 
Xeo
namespace std
{
    extern ostream cerr; // UB :(
}
 
user3010322
You could create a forward-declared function that returns an ostream.
 
9:36 AM
@rubenvb impossible without UB
 
user3010322
And then just define that function way, way later.
 
@Rapptz how is that?
 
see message above
 
oh you mean without including <iostream>...
 
user3010322
Why do you need std::cout and std::cerr anyways?
 
Xeo
9:37 AM
@ThePhD That still necessitates that <iostream> is includeda t some point.
 
stdout and stderr.
 
Xeo
@ThePhD Default output
 
imma just include it like a champ
 
while(std::getline(oss, s_input,'\n')) {
lines.push_back(s_input);
counter++;
}
 
user3010322
header-only?
 
9:38 AM
i guess that is better then?
 
Xeo
yes
 
user3010322
Bleh.
 
BLEH
 
user3010322
If it wasn't header-only you could use a free function and implementation hiding.
 
wtb #import std.cerr, std.cout from iostream
 
9:39 AM
Oh i didn't know that worked
 
Xeo
@user2372903 It doesn't, hence "wtb"
 
Wrong chat
sorry
ignore that, right now
 
is there a better alternative to int b = *((int*)ar); in this case coliru.stacked-crooked.com/a/e4fbec8634070f44 ?
 
int* b = &a;
what are you doing man
 
9:41 AM
@AlexM. int b = *reinterpret_cast<int*>(ar);
 
int b = *reinterpret_cast<int*>(ar);
 
What about.
 
Xeo
"not"
 
ikr
 
9:42 AM
@Rapptz This.
 
@Rapptz I tried to turn an int into 4 chars and then back into an int
 
b = a, fixed.
 
Xeo
@AlexM. That's not how that works
 
@AlexM. that only made it even more confusing
 
@BartekBanachewicz immense overkill.
 
9:42 AM
@Rapptz error: cannot convert 'char**' to 'int*' in initialization
 
Xeo
reinterpret_cast<char*>(&a) does not produce a 4-char string or something
 
You might as well ship Virtualbox.
 
@Xeo 4 chars as in 4 bytes
 
@Xeo it is an UB-free 4 byte array of the int.
 
and then put them back together
 
9:43 AM
@rubenvb well that's what the guy in my company wants to use
 
@AlexM. Er, no.
 
well, pointer.
@BartekBanachewicz That's quite ridiculous, IMHO.
 
Xeo
@rubenvb He said char :P
so that's what I picked on
 
er, that was not what I wanted to do
 
9:44 AM
@Xeo but char is actually more correct than byte, because well, CHAR_BITS
 
I get the joke though
 
It's not a joke.
 
this sounds like an X/Y problem
 
And he never said string either, so he was right.
 
Xeo
@rubenvb a char is a byte, a byte is a char. vOv
 
9:45 AM
okay how about
 
@rubenvb OH GEE NOT THIS AGAIN
 
lol
nvm
 
why do you want 4 char from 1 int?
 
maybe people with very high reputation dont like to answer simple questions which feels time wasting, but there are other people who feel happy to answer these questions though. — Harendra Singh 7 hours ago
 
I'll drop it
 
9:45 AM
not this again
why are people so fucking STUPID
 
"byte" is more correct because those things are bytes.
 
what the hell does broadness have to do with difficulty level?!
grrrrrrrrrrrrrr
 
@Rapptz to put in a byte stream
 
> How to insert data in a MySQL databse using mIRC
What?!
 
Xeo
@ParkYoung-Bae lol
 
it's little endian to little endian in my case so it should work
 
You didn't read it, I see.
 
@LightnessRacesinOrbit in your comment: s/not one of/not any of/
 
@R.MartinhoFernandes chat stopped updating, had to refresh
only saw your message now
 
Though I noticed now it misses code for writing.
 
9:50 AM
@rubenvb I don't think he understands what he wants is impossible
 
If you really want to just blast bytes to memory to recover in the same process later, use memcpy.
 
he asked me if I know "how to do that but without 3rd party stuff just with standard GNU toolchain"
@AlexM. that tells precisely nothing.
 
exit code -11.. wot
 
@BartekBanachewicz Well, just use a custom toolchain against an old glibc, ship the gcc runtime so's, as well as any other libraries you use (set rpath) and you're fine on virtually every Linux distro out there.
 
I feel like I've run into this before
 
9:53 AM
"Virtually"... get it?
 
@R.MartinhoFernandes the thing needs to be sent via tcp/ip, so another process will parse the stream and read the int
 
apparently I've search for "exit code -11" 2 months ago
 
the article helped though, thanks
 
my great googling skills
 
@AlexM. binary serialization.
 
Xeo
9:55 AM
@AlexM. Asio has streams that should handle that, IIRC
 
@BartekBanachewicz does that still work if I use char buffers?
 
oh
it's segfault
 
I send something like this
 
heh
 
int, char, char, lots of chars
 
9:56 AM
@AlexM. the point of serialization is to "make it work"
 
It's similar to Cap'n'Proto but it actually does something, meaning versioning and stuff works.
 
I can't use that unfortunately
 
@AlexM. why
 
I can only use boost
 
Cap'n'Proto doesn't do versioning?
 
9:57 AM
@AlexM. why not protobuf or flatbuffers or
 
@BartekBanachewicz because those are the requirements that have been imposed
 
copy the source of flatbuffers into your code.
 
that would probably look bad since it's a project meant for me to accommodate with the tools used here
 
> Not at all! New fields are always added to the end of a struct (or replace padding space), so existing field positions are unchanged. The recipient simply needs to do a bounds check when reading each field.
 
Oh my, disappointment
 
9:59 AM
creating your own crappy solution for something that's been already solved over and out is nonsensical
 
And that's only for backwards compatibility.
FlatBuffers does forwards compatibility too.
 
interesting
 

« first day (1371 days earlier)      last day (3574 days later) »