« first day (1625 days earlier)      last day (3548 days later) » 

11:01
FF 36.0.4 on Windows is shit. Annoying script crashes ever since last update:(
Oh man the binding of Issac is one of most depressing games I've ever heard about.
I need to make a more depressing game...
in C++!
@MartinJames I have the Dev Edition. I really love it when it just hangs when loading a large-ish image.
/s
My firefox just closed a tab by itself
am I hacked?
Did you press Ctrl+W subconsciously?
I don't tend to press Ctrl+W subconsciously.
11:16
I tend to sleep subconsciously.
It's a bad habit.
user1804599
I have a deadlock.
user1804599
And I don't know why.
because threads
Get the stack traces from both waiting threads.
And it should become clear.
Restart life. Much simpler implementation.
user1804599
11:18
while (running)
    ;
running = true;
currentFiber = this;
pull();
currentFiber = nullptr;
running = false;
Hello!!

I am asked to state the two versions of the Knapsack problem and their differences. Could I formulate it as followed??

The Knapsack problem is the following:

There are $n$ items, where the ith item has a benefit of $v_i$ and it has weight $w_i$. We want to pick some items so that we maximize the total benefit while keeping the total weight of $W$.

The difference between the integer and the fractional version of the Knapsack problem is the following:

At the integer version we want to pick each item either fully or we don't pick it. At the fractional version we can take a part of
user1804599
Seems to be coming from here.
user1804599
Ah, if I use a mutex instead of a spinlock I get this:
user1804599
> mutex lock failed: Invalid argument
user1804599
Fascinating. Let's use a debugger.
11:22
@MaryStar That problem is one of the best described everywhere on the intertubes. Seriously. If you can't just do it yourself and be sure of your answer, you might consider not studying computer science.
user1804599
> (mill::Fiber *) (anonymous namespace)::currentFiber = <No TLS data currently exists for this thread.>
user1804599
lolwat
user1804599
Aaaaaaa lol.
user1804599
It's a fiber. It can suddenly run on a different thread.
ho crap
I forgot about the hour change
silly DST
user1804599
11:25
And here's a race condition:
user1804599
while (running)
    ;
running = true;
> As a rule of thumb, when you convert optimized C++ to Java, the code is about 3x slower. As a rule of thumb, when you convert Java to C++, the code is about 3x slower.
haha awesome
user1804599
Ah, I need compare and swap.
user1804599
Fascinating.
11:35
int x, typedef y;   // doesn't compile :(
int typedef const z;   // Well, at least this does compile
wat wat
@fredoverflow development time
user1804599
Ugh, what the fuck.
user1804599
I have std::atomic<bool> x;. I want to [set x to true and check whether its value has changed] atomically.
user1804599
Is that possible?
@Pris Mostly because of IDEs, I would guess. Yay refactoring support.
user1804599
compare_exchange_strong takes an lvalue reference as its first argument.
@fredoverflow How about 'lack of language complexity'
Isn't MSVC a solid IDE? Does it have refactoring support? QtCreator seems to but I can't get it work... and I'd bet CLion does as well since it seems really advanced
@райтфолд If you set x to true then its value has changed.
11:40
C++ refactoring is crappier than Java etc.
user1804599
Ok wait. Let me rephrase.
Why not just use the default safe memory model? Do you have speed issues?
MSVC doesn't really have refactoring support
Maybe JetBrains will bring it up to speed.
user1804599
I want to [set x to true iff x is false and check whether its value has changed] atomically.
11:41
Resharper for C++ is a good step for VS.
@райтфолд thaat still sounds funny. Do you mean test_and_set?
> Atomically changes the state of a std::atomic_flag pointed to by p to set (true) and returns the value it held before.
@райтфолд It's a somewhat confusing API, but you don't need the out-param part.
just do bool b = false; if(compare_exchange_strong(b, true)) { // changed }
user1804599
I'll use a mutex.
in fact ISTR that people were complaining about the use of the out param and whether or not it was truly necessary
11:47
So a C++ -> Java -> C++ roundtrip, is that 1x or 9x? ;-)
9x then
I'm now imagining people nearly converting Java -> C++ as close to directly as possible, copy by value and all
I found a new buzzword
> He believes in Mechanical Sympathy, i.e. applying an understanding of the hardware to the creation of software
Do you program with mechanical sympathy, lounge?
not until C++ gets carry flag support ;)
uh
obviously everybody programs with a degree of it
but there's hardly any of real use
@Pris If you consider slamming the desk instead of the keyboard as "mechanical sympathy", then yes.
user1804599
12:04
user1804599
Eh when I have struct { T a; T b; }; the b is destructed before a right?
@Puppy I don't agree that there's hardly any of real use. It's pretty important for performance-critical stuff to understand how caches (particularly in threaded code) and vectorization work, for example. It is good to understand not just that but why walking through a large 2D array by row is much faster than doing so by column, and vectorization can have an impact on your data structures.
I have never heard the term "Mechanical Sympathy" before, though.
@райтфолд Yes.
by "it's pretty important for performance-critical stuff", you've pretty much already relegated it to hardly ever useful.
user1804599
Nice.
@Puppy Yes, of course. It's not like anything important requires number crunching of any sort.
12:12
important and rare are orthogonal things.
and even importance and usefulness
Embedded systems likewise don't exist, or at least are not numerous.
what's much more important is how numerous embedded programmers are.
since the effort to train programmers is obviously per programmer
There are many of them, although I'm not sure how many have mechanical sympathy™.
many is not a useful measurement.
user1804599
12:17
Vasa Knäckebröd
Very many? More than you seem to think, anyway. You need them for everything (attn: hyperbole) that's built today.
that's irrelevant.
you're measuring something that completely does not matter whatsoever.
at least not in this context.
I didn't notice where the context was confined to desktop applications and cellphone apps (mind you, it has happened to me that those behaved sluggishly in the past). It is useful to have at least a cursory understanding of the hardware when writing software. That is more urgently true in some contexts than in others, but it is true in all.
no, the context is about programmers.
therefore what matters is where the programmers work and what applications the programmers write.
if hardly any programmers work in embedded software, it is not useful to go teaching all the others about the hardware.
since it's clear that the cost of educating programmers is proportional to the number of programmers and not the number of people who use their products.
Hm. I have difficulty finding numbers.
12:25
for (int i = 0; i <1000; ++i) printf("found number %d\n", i);
...the number of embedded programmers vs. the number of programmers in general.
the last I read it was 2-3%
Really? That's surprisingly low. Do you remember the source?
no
12:26
but it makes sense.
fact is, the nature of embedded systems means that they can't support a large programming team, since the hardware can't support complex programs.
That was true ten years ago.
Well, fifteen.
well, the more complex programs they support, the less embedded they are and the less mechanical sympathy you need, don't you think?
Depends. Sometimes real-time linux is not enough, and you end up with ChibiOS or so.
Although you'd probably split that into a module of its own, then.
having an operating system at all pretty directly removes you from needing a lot of mechanical sympathy.
Not in the case of ChibiOS. It's...rudimentary.
Anyway, I concede that the part of embedded programming that requires an intimate understanding of all involved hardware is limited.
I still believe that even a web hipster can benefit from a cursory understanding of hardware, though.
12:31
far less than he can benefit from knowing the rules of CSS or good design.
Is 'mechanical sympathy' an actual technical/industry term? I only posted it because I thought it was a fancy buzzword that so many people seem to coin these days
I have never heard it before.
in fact, since he doesn't know the machine he's running on, it's hard to have much sympathy for it.
and I also have never heard it before.
I've heard 'data oriented design'
BINGO!
12:33
I'm not sympathetic to my computer at all. I yell at it and my compiler all the time
i ought to get dressed
@Pris It could be that you're more sympathetic to it than most, and that you feel its pain without realizing. #3deep5me
Is it common to have O(n) complexity for std:unordered_map ?
@khajvah Depends on how shitty your hash function is.
@milleniumbug Isn't hash fucntion provided by std:?
12:44
Or how many buckets you have
Anyone understand what the second '0' in this initializer list does:
auto l = {0, ((std::cout << args), 0)...};
I need to hold a bug data (like 2d unordered_map of 4000 entries)
@Pris It’s the value of the (bracketed) expression.
You want a value to initialize with.
user1804599
:(
@khajvah Not for your own types, or if you provide your own.
12:48
In the C and C++ programming languages, the comma operator (represented by the token ,) is a binary operator that evaluates its first operand and discards the result, and then evaluates the second operand and returns this value (and type). The use of the comma token as an operator is distinct from its use in function calls and definitions, variable declarations, enum declarations, and similar constructs, where it acts as a separator. == Syntax == The comma operator separates expressions (which have value) in a way analogous to how the semicolon terminates statements, and sequences of expressions...
Like std::unordered_map<int, std::string, MyHash>
@milleniumbug Got it, I need to write my own then, thanks.
Thanks, this made it perfectly clear
@milleniumbug You can in fact plug your own types into std::hash though. It’s where I would start, too.
12:54
@Pris I don't think that is normal at all.
Haven't we already had this discussion?
Dang it chat
This is what my chat looks like right now: i.imgur.com/jCbe1QO.png
@chris Must have missed it. What did you all conclude, so that I may be contrarian and refute it and make people upset
11 hours ago, by Rapptz
> All I do at work is Google how to do things, then modify the code I find on Stack Overflow. I don't feel like I'm actually programming. (self.learnprogramming)
@chris I should really start searching the transcript before posting stuff eh
12:57
@Pris nah, no real conclusion was reached
@Pris That's actually harder to do than expected.
13:12
@Mgetz Props to that dude, frankly.
@Puppy he's apparently VERY good at this sort of thing
does anyone know if there's a keyboard shortcut to create a block comment /* ... */ in visual studio? CTRL+K+C only creates a // beside each line instead of a block comment
@hb20007 /* ... */ comments are shit.
@hb20007 Resharper seems to have one. Can't say I use that feature.
13:20
@milleniumbug interesting. I prefer // but my professor recommended that I use /* ... */ . So why are they shit?
If you prefer, Visual Assist X seems to do it
@hb20007 No nesting.
@milleniumbug uh.. what do u mean?
@milleniumbug /* real code /* comment */ */
@hb20007 Why would you want a shortcut to make a block comment?..
13:22
the first */ messes up the comment block
@hb20007 /* a comment /* a comment */ not a comment */
@hb20007 Or do you mean enclose some code?
@milleniumbug oh, I get it now. I didn't know this wasn't allowed
@MarkGarcia yeah, that's what I maen
If you want to disable a large swath of code use #if 0
@milleniumbug so thanks, now I have an argument for my professor to prove // is better
13:25
@hb20007 ...? you just randomly want to argue with your professor?
or did they require you use /* */?
@Blob he just suggested that I could 'improve' my code by using /* ... */ instead of //
Plot twist: the rest of the code has to be C90-compatible
@hb20007 "improve"
@Blob but this rule about using " ... " instead of ' ... ' applies only in programming not in English :P
Morning
13:31
@hb20007 I'm guessing his preference is a holdover from the olden days, when // comments were not allowed in C and C++(ish) compilers existed that didn't accept them.
@Jefffrey Good mourning!
or he just doesn't like the "//" in front of every line
@Jefffrey Damn that looks good
@Pris for all you know, the dark stuff could be faeces.
Enough with faeces.
13:35
not-enough-developers has to be a myth -.-
user1804599
Awesome!
@Blob what is 'not-enough-developers'
@Pris not enough programmers to fill jobs, supposedly
@hb20007 I use /* */ for blocks of documentation and // for inline code comments, and I don't even know why
13:38
Comments are for wusses.
I see way more C source code that uses /* */ as opposed to C++
> PHP Software Engineer
how the fuck does PHP make software
@Pris Because C used to didn't have // comments.
> Please help me, since I have to submit my work with DOSBox.
13:41
@chris "submit my work with DOSBox" - whoa, that's hardcore
> Agile/iterative development methodology and ability to acclimate to quickly changing project requirements
lol
@Blob whats funny about that?
@Pris the nightmare
A bit tautological.
I don't think I'll ever get tired of this: youtube.com/watch?v=-5wpm-gesOY
Ok, I got it. I will request my teacher to allow us working with Visual Studio instead of this old DOSBox. @arun thanks! — Syed Rafay 40 secs ago
Best Turbo-using OP ever.
wtf is dosbox?
13:54
@chris I bad for people who have profs/teachers that force them to use old and outdated shit
wtf is google?
@khajvah dos emulator iirc
@milleniumbug Isn't SO about googling for others?
@Pris Same here, why would you teach something that is completely obsolete?
@khajvah No, not really.
13:55
When the entire course is going to end up doing more harm than good, something is very wrong.
@chris lazy/crappy teachers. Especially if you're running dosbox, you can probably install a basic linux through a vm with gcc or clang
@Pris Or use them on Windows just as easily, whatever.
Just as easily as setting up the VM I mean.
@chris ive heard its a pain to use gcc on windows
@Pris For school purposes, MinGW and cygwin work just fine.
@Pris // is C99
13:58
@Pris I used to think that too.
That Indian schools teach pre-standard C++ using Turbo C++ in DOS emulators drives me to such abject racism.
:P
It might take a bit more looking to get a couple of GCC things going.
@LightnessRacesinOrbit I wonder what it is about India and Turbo.
@LightnessRacesinOrbit Why are they doing that?
@fredoverflow Is that one multilib?
13:59
@LightnessRacesinOrbit better than java
I personally use TDM-GCC-64
and MSYS.
FWIW, there's no libc++ on Windows yet, and I can't get Clang working with some versions of MinGW
> My MinGW distribution ("distro") is x64-native and currently contains GCC 4.9.2 and Boost 1.57.0.
@chris imo it seems so much easier to just install a vm. You don't even need a distro with a gui if there are issues with video drivers and all that jazz
@Pris Yeah I was planning on using my VM for libc++ and the newest versions of Clang.
14:03
It is even easier to throw away windows.
And there are some Sublime plugins that are simple to install on there and impossible on Windows.
@khajvah Not when you want to play games that don't work (well) on Linux.
Dual-boot
@Pris It's not compilers that are pain to use, it's dependencies
Dual boot is a waste of time
@khajvah I tried that. It was very annoying.
@CatPlusPlus I always see people on windows ask about path issues for libraries
14:06
dual-boot takes a few seconds
What path issues
@Veritas On my laptop it takes minutes but that also means that I can't play games.
Οnce you go SSD you never go back.
@CatPlusPlus They probably put dlls in C:\usr\lib
14:09
Whatever it wouldn't be it's PEBKAC so you shouldn't be interested
This is weird.
I can compile through the command line but I can't compile through my makefile.
And the makefile has the same exact command.
had a similar issue at VS at work
could compile with MSBuild at the command line but not from in VS.
Are you also getting "No such file or directory"?
does anyone here happen to be in new york and want a slave in their job? i'll make coffee, clean your desk, whatever ;_;
for freeee
fail
14:14
@Blob Is blowjob included?
@khajvah uh.. not that desperate yet.
@Nooble No, of course not. I obviously do not actually have the same problem.
@Nooble Are you trying to compile from the same directory?
14:15
@khajvah Yes.
Neat, I can now create a bitmask for a unique combination of types: auto mask = GetTypeMask<int,double,bool,etc>();
cmd and the makefile are in the same directory.
@Nooble no it doesn't!
@Nooble and you're running the makefile from within that directory?
Same directory.
um that doesn't prove anything
14:17
Well the command prompt is running in that directory.
time to show some evidences!
Okay one sec.
brb putting quick jel on my flan
could someone help me with this weird error? i.imgur.com/kajpbCl.png It says "expression must have a constant value" but wordLength is a constant
@hb20007 It needs a compile-time constant.
14:20
@chris what's that?
@hb20007 A value known at compile-time.
no.
@LightnessRacesinOrbit Here's the command line output. First I use the makefile, and then the second time I manually enter the command.
@chris oh, I see now. I think I
'll have to use the 'new' keyword
but why not use std::vector?
14:22
Yes, use a vector if you want a runtime-sized array.
Being able to resize it through its interface (which you can do with new[], too) is worth it.
my professor wants u to use C-style arrays... another one of his (senseless?) preferences maybe
@hb20007 It's not senseless
@khajvah: why is that?
@hb20007 You should learn C-style arrays too
well you should know how to work with c-style arrays so I guess your professor wants you to get familiar with the basics first
14:26
yeah, but since the vector library is better and does everything C-style arrays can do, I wonder why we learn them at all
@hb20007 vectors are built on top of c-style arrays.
@hb20007 It teaches you a bit about pointers and how memory is laid out in a contiguous array. Also interfacing with C arrays is pretty common (when using other libraries and so on)
Seriously why the hell isn't this working.
@Pris: I must admit, that's a good answer. I'll get back to using C-style arrays with a smile on my face now :P
@khajvah No, not really.
14:32
@JerryCoffin What then?
@hb20007 There's no particular reason to learn C arrays at all.
use std::vector and std::array instead exclusively.
o_0 huh T t = T("he he"); should be able to wrote as T t("he he"); instead write... T only has a single string member, and has a constructor taking a std::string
yes.
error: expected identifier before string constant
:\
@khajvah It's built around a block of allocated memory, yes. That's allocated via an Allocator object, which is completely foreign to C. It then has objects constructed in it using placement new, which is also completely foreign to C. To destroy objects, you directly invoke their destructors--yet again, completely foreign to C. Bottom line: yes, there's a block of raw memory, which is vaguely like C (or nearly anything else), but that's about the only part that's similar at all.
14:35
probably means macro shit going on
@JerryCoffin Not to mention that it's all safely encapsulated- again, not at all like C.
user1804599
#define T breaks libc++ if it appears before an include of a certain header.
@Puppy Lots of libraries still hand over data to you as an array. ie. char * GetDataBuffer() is pretty common
user1804599
Because the fools forgot they should use reserved identifiers.
@Pris Those libraries are shit.
and furthermore you don't need to actually know C arrays to std::string x = GetDataBuffer();
@Pris wrap that shit up then
14:38
@thecoshman How would you wrap that up? Say you got a byte array for some image data to modify or something. Copying it into a vector would be needlessly expensive
Also I bet you get buffers like that when interfacing with hardware too. Its pretty common and I think it should be taught even in a c++ course
@JerryCoffin Ok, I admit my ignorance, thanks for the info.
@райтфолд Wow, that's actually pretty surprising.
Though you should never use it over an array or vector, just like using raw pointers is less safe than using unique_ptr or whatever
Surprised I've never heard STL mention that, the way he goes on about the things you have to do to keep everyone's code happy.
@Pris Oh noes, the performances! Of some random code that isn't even in a hot path!
14:40
fairly sure you can pass a blob of memory into a vectory/array for it to then manage...
maybe...
sounds a bit dodge though
nope
not without doing some Funky Allocator Shenanigans™
user1804599
Can the compiler optimise out the vector in case of default allocator?
it probably could in theeeeory but no compiler is that powerful at the moment afaik
@khajvah Admitting your ignorance is a good first step. If you're ready to learn more of the details of what I just outlined, feel free to read my blog post about it.
user1804599
clang doesn't. :[
user1804599
14:43
%1 = tail call noalias i8* @operator new(unsigned long)(i64 4096)
user1804599
lolwat tail call
I believe that in LLVM IR, the tail call only means that it can be TCOed, not that it actually is a tail call.
assert ( b1 . CountCars ( "Peter", "Smith" ) == 0 );
So much space
@JerryCoffin I actually tried to read the vector.tcc of libstdc++ but I need to spend more time, as it is a bit complicated.
14:46
@khajvah Yes--most standard library headers are pretty ugly; rarely a good way to learn, I'm afraid. Older ones are especially horrible, but even new ones are pretty nasty (at least as a rule).
that's because names mustn't collide and the file size should be small. Plus the use of ugly macros.
file size should be small?
who gives a shit about the file size of headers?
@Puppy Users who spend time waiting as they get parsed.
I doubt that using longer identifiers increases file parse time
or adding comments.
@Puppy Technically, you're correct--it increases lexing time, not parsing time. But yes, lexing time is a significant enough part of compile time that you can usually estimate compile time pretty accurately based simply on the number of characters of input (though, of course, some things like heavily recursive templates can change that very quickly).
14:54
you can reduce the number of characters of input far more effectively by not including extra headers, forward declarations, etc.
erg... rules of N :| if I offer a constructor taking an argument for each member... does that mean I need to do the other shite as well and loose {} initialisation?
I thinks not...
@Puppy To an extent, yes--but when you've already eliminated obvious cruft, a fairly obvious next step is to reduce length of individual headers. Being fair, commercial libraries (especially) are probably just fine with the idea that the header is difficult to read (in fact, some are quite apparently intentionally obfuscated).

« first day (1625 days earlier)      last day (3548 days later) »