« first day (2106 days earlier)      last day (2841 days later) » 

12:10 AM
@KretabChabawenizc A good alternative to nicknames is to assume somebody else s identity.
 
What a wonderful idea, I'm stealing that.
 
preferably an enemy that doesn't know they've wronged you
 
Almost won a darwin award - suicide attacker only got himself badly burnt
 
Nearly 8 years of using C++ as one of my primary languages and I still put all my code in one file because I can't get includes to work properly... How has the include system basically remained the same terrible thing it started as?
(Or at least, how do I properly include a file declared in a .h and defined in a .cpp?)
 
12:20 AM
No, we have modules now
 
we do?
 
I'm sure none of your coworkers in general think we have modules.
 
shhhh no tears only dreams
 
I also work alone
 
he he
 
user406009
12:22 AM
@Aaron3468 What is your exact issue?
 
@jaggedSpire See, I really like C++ except that the compiler is a lazy piece of shit that gets less work done than I do
 
 
user406009
I almost never have issues with #includes. Except when people start playing games with the preprocessor leading to ODR violations.
 
@Shoe that's terrifying
 
@Aaron3468 Writing C++ compilers is an awful job
Respect those that try
 
12:24 AM
C++ compile times can get bad, on rare occasions you need to structure your classes in in some bullshit way.
 
@Shoe wth
 
IncrediBuild helps
 
@Aaron3468 I mostly feel grateful that it can handle all the horror-shows I throw at it
however badly
except VC++
 
@Aaron3468 haha. Don't define files in your cpp
 
I hate VC++ and I've suppressed almost all my memories explaining why. There's just this murky feeling of absolute rage.
 
12:25 AM
Java sucks.
 
maybe I should stop suppressing unpleasant memories
nah I'm sure it's fine
 
user406009
@DeanSeo The question is if it sucks less than the alternative.
 
@Lalaland I had a .h with declarations + include guard that later included a .cpp with definitions. Classic Programmer Solution #3: Definitions in .h file
 
@Aaron3468 you mean, how do I master it? Apply it in a non-broken way?
Look at existing libs. Understand why templates are in headers. Understand forward declares. Understand pimpl. That's it.
 
Java has (most) of the complexity of C++ without any of the advantages.
 
user406009
12:26 AM
@Aaron3468 Why would a .h include a .cpp?
 
@Mikhail Nowhere near the complexity of C++
 
@Shoe That I do. I have no clue how they make C++ code compile instead of opening portals to hell
6
 
user406009
@Mikhail Most of the complexity in Java you can ignore.
 
@Lalaland If the alternative indicates C++ as part then it's an insult to C++. C++ is not alternative, but path to a better world.
 
I'm really talking about the structural complexity of the resulting code.
 
12:27 AM
@Aaron3468 if they did then they really could provide nasal demons in case of UB!
 
user406009
In C++, you either know all your ownership rules by heart or you are going to die debugging.
 
But also in Java
 
@Lalaland The only rule I need to know is that C++ owns me
I bow to my overlord
 
@Aaron3468 you are on fire
 
combo
 
12:28 AM
Pizza
 
is delicious
 
so much
 
dammit now I want pizza
 
Have some caviar instead
 
@jaggedSpire I learned C++, that's part of the job description. Being fired, on the other hand, is mercy because it's past tense.
 
12:29 AM
@Aaron3468 :D
 
Isn't being present tense?
Like Sarte's famous work?
 
That is true, though there is a tense that means 'to be in the state of having been'
So just declare in an include-guarded .h file and the only .cpp file should be the entry point? /cc @sehe @Lalaland
 
user406009
@Aaron3468 What do you mean by entry point?
 
int main or equivalent
 
Unless you got templates...
 
user406009
12:38 AM
Yeah int main should be in a .cpp. As well as all the definitions of everything that you declared in the .h.
 
Okay, so then .cpp is where all the code gets put together, and .h is where some of it comes from?
 
user406009
@Aaron3468 Declarations go into the .h. Definitions go into the .cpp. That then begs the question of what is a declaration and what is a definition and things get a little more complicated.
 
user406009
 
True. As it is, it seems to compile happily with main.cpp:#include "Foo.h" \n //do stuff
Thanks for the help. It'll be a while before I figure out all the idiosyncrasies of C++, but it'll be easier to work with now that I'm not stuck in one file + whatever libraries I include.
 
12:47 AM
I thought you knew better...
 
I know better, but you find creative ways to pretend when the compiler doesn't follow logical rules. I haven't had issues figuring out includes in Python, Java, Ruby, etc (within a few hours/days), but it's taken me years to figure out the voodoo of C++ as much as I love the language
 
user406009
Yeah. The distinction between declaration and definition in C++ is dumb. It would have been nice to have a proper system.
 
user406009
For interest's sake, @Aaron3468 is there a particular reason why you have to use C++?
 
user406009
There are lots of alternatives nowadays.
 
user406009
Rust is very nice.
 
12:52 AM
declaration and definition lets you link stuff from external libraries
There are two problems with C++'s include system one is templates and the easier one to fix is the include system. The biggest problem with includes is that we don't have modules...
 
@Aaron3468 just declare in headers what you want in the public interface. Put in cpp what you want to be implementation. All code is allways in a translation unit (even if included via a header). If you include definitions in headers, you'll make it hard/impossible to include headers in multiple TUs
 
user406009
@sehe You could also just mark everything inline.
 
user406009
I think it's sorta sad that we are seeing a growing spread of C++ header only libraries.
 
user406009
It's like people just give up on C++ build systems.
 
Or distributing binary sucks?
 
12:59 AM
@Lalaland Are these libraries mostly templates?
 
@Lalaland I program on many platforms and it's always available, has a massive variety of cross-platform primitives like uint8_t, and Java - my other primary language - doesn't have a good ecosystem of primitive types. Most of the other languages I use are slow interpreted ones. I've got my eye on Rust and once it has a proper GUI toolkit, it'll be excellent for my needs.
@sehe True, I'll need to do research because it doesn't seem to work the way I tried to put the implementation into .cpp
 
user406009
@Aaron3468 If you post links to the files, we might be able to tell you what was wrong and save you some time.
 
user406009
@Insilico No.
 
user406009
I was thinking of stuff like github.com/nlohmann/json which I ran into the other day.
 
Guys i finally finished GDT!
it was tedious.... had to blow off many errors
 
user406009
1:09 AM
GDT?
 
user406009
@user5600875 Oh, you are writing an OS? Nice.
 
Yea , gotta love big projects :)
 
1:53 AM
@Lalaland not at all. It shows that people have stopped caring as much for "protect our proprietary code" and instead value using C++ for what it's good at.
Meanwhile, huge masses of C++ code bases use the compilation model just always and as intended, where pervasive implementation visibility is not a core value.
Note as well, LTO is becoming increasingly mainstream and it seems to remove the rough edge driving people to header-only libs. So, we might see a movement back, in favour of compilation times
 
Umm, header only, and single header are a little different
 
Umm. I'm not confused about this.
Why even bring it up. I responded to a specific message.
 
So, I think most people aren't too worried about PIMP/compile time issues when they choose to make header only. I think this question summarizes the advantages:
34
Q: Benefits of header-only libraries

NebulaFoxWhat are the benefits of a header only library and why would you write it that way oppose to putting the implementation into separate file?

 
user406009
I still think the biggest driver towards header only libraries is the lack of dealing with stupid build rules.
 
BUT "Longer compilation" would be solved if it was a module
 
user406009
1:58 AM
And you can easily vendor your dependencies if they are also header only.
 
user406009
Which makes everything easier.
 
@Mikhail duh. Of course header only doesn't quite have as many pimpl issues...
@Lalaland I don't.
 
user406009
Well, on a sane OS with a decent package manager, I find it's not too much of a problem.
 
@Lalaland I think the biggest driver towards C++ is the same as the biggest driver to header-only: pervasive compiler optimizations. Like I said, LTO will probably fix the most extreme cases
 
user406009
But when I want to compile something on windows. And that thing also has a bazillion dependencies. Each with a different build system.
 
2:02 AM
Oh well, can't use Windows ;-)
Also name mangling, for C++
 
@Lalaland There are vastly different kinds of dependencies. Say, take libclang: it's clearly a case for interface/impl separation, and lo: it does.
However, Boost String Algorithms is clearly a candidate for header-only (simply because it make sense to inline things like "ends_with").
 
user406009
@Mikhail That's why we have extern "C" :P
 
I don't for a second think there are some petty devs in Boost taking the lazy way for library design there. In fact, to suggest it as the reason for header-only libraries strikes me as... mildly ignorant
 
user406009
The best feature of C++: being able to use the C ABI
 
Right. Because everyone knows Haskel FFI, Lua, P/Invoke etc. are such pains. (not)
 
2:06 AM
Yeah, I wrote an inverse solver a year ago and realized the only way to distribute (closed source) was to have a C style API.
 
user406009
@sehe Just trying to make a joke :P But in all seriousness, I do find myself reaching for that C ABI annoyingly often.
 
I guess the only way to move towards an object oriented std::future is to use COM :-)
 
user406009
Most languages do tend to have good C FFI though.
 
user406009
Even Java's isn't half bad.
 
^
 
2:08 AM
Java is NIO?
 
JNO IIRC
 
user406009
@Mikhail It is JNI.
 
user406009
 
Most of my native<>Java interop comes from Android...
 
@Lalaland Supersed by JNO AFAIR
 
user406009
2:10 AM
JNO?
 
user406009
@Mikhail One trick you can pull is to have a C style internal API with a header only C++ API on top.
 
C++ to C to C++
 
user406009
That's the trick I am trying to pull in my latest project: github.com/Lalaland/DataChannelServer
 
user406009
It seems to sorta work well.
 
Notice how we're changing the architecture of our code because of linking issues, this is not a language success story.
 
2:19 AM
@Lalaland Misremembered the changed letter:
Aug 12 '15 at 14:24, by elyse
Prefer JNA over JNI if possible.
 
user406009
Yeah, JNA can be nice. The main cost is that it is yet another dependency which may or may not work.
 
user406009
The last time I used it I had to eventually strip out the JNA because it wouldn't work on POWER8 for some reason.
 
Apr 30 '15 at 16:05, by rightfold
And JNA doesn't require a separate non-Java build step.
 
summer bear don't sleep?
 
2:36 AM
@Telkitty Well. What's the polar opposite to hibernation?
 
@sehe Summernation?
 
aestarnation would be close
 
Consternation?
 
Noun: aestās f ‎(genitive aestātis); third declension
  1. summer
Winter is hiberna
 
It's a cool word.
 
2:40 AM
It is, though it means something like "fiery" :)
 
Aestivation or æstivation (from Latin: aestas, summer, but also spelled estivation in American English) is a state of animal dormancy, similar to hibernation, characterized by inactivity and a lowered metabolic rate, that is entered in response to high temperatures and arid conditions. It takes place during times of heat and dryness, the hot dry season, which are often the summer months. Invertebrate and vertebrate animals are known to enter this state to avoid damage from high temperatures and the risk of desiccation. Both terrestrial and aquatic animals undergo aestivation. Organisms who aestivate...
 
Cool. I knew I could count on you
Wait. Not dormation.
 
@sehe No, not cool. Didn't you read? That's when you sleep because it's too hot.
 
My message to the same effect predates yours by almost exactly a minute. Didn't you read?
Also, still a cool word.
 
2:46 AM
:)
Okay. Fixed all my bugs. I might get to go on a holiday after all. So, sleep time now :)
 
@sehe have fun
 
3:14 AM
guys this function:
is giving me
stdlib.c++: In function 'void printf(char*)':
stdlib.c++:12:28: error: lvalue required as left operand of assignment
 +   num_count_viedo_memory = num_count_viedo_memory;
                            ^
stdlib.c++:13:5: error: expected primary-expression before 'continue'
 +   continue;
     ^
stdlib.c++:14:4: error: expected primary-expression before '}' token
 +  }
    ^
i got it.. i accidently did + 's
 
4:04 AM
 
4:19 AM
Good Night Guys!
 
5:05 AM
I spend a lot of time abstracting/refactoring code when I should be completing the project and iterating again ^^;
 
An alternative development strategy is called "dump and run"
 
Tell me about that one
 
aka scrum?
 
TIL that the scrum is located near the taint.
 
5:30 AM
only if the code you dumped crashes
 
6:03 AM
While programming, I get stuck choosing a good implementation. At the moment I'm deciding how to write a good wrapper for output pins so that peripherals don't need to know the difference between PortD and PortC.
 
What does that mean?
 
Microcontrollers usually have a group of 1-bit outputs put together into a port to allow it to be accessed as a byte. For example, pin 13 might be bit 3 in portB and 12 might be bit 6 in portC. The normal way of modifying these values is with something like portB |= (1<<portB3). If you write a LCD screen class, you may need to use pins on multiple ports, and you might have multiple LCD screens connected..
The code gets very messy because the LCD needs to know about the implementation of the microcontroller; it's tightly-coupled so to speak. It's easier to initialize with something like LCD(pin 13, pin 12, pin 5), so that the LCD only needs to say pin.on(). Then the LCD doesn't need to know what port the pin is on, and which address within that port
 
I would have a static map that is loaded at run-time, similar to the pin planer in an FPGA.
This seems familiar to the FPGA "pin planer" in quartus
 
It might be. Do you have a link for more info?
 
HIHIHI
I'm in a good mood today!
Anyone here heard of Minetest?
 
6:18 AM
I heard of it, but I don't think I've used it
What's the news?
 
Zenzizenzizenzic
 
@Aaron3468 It brings back childhoold memories
Ever since I decided to only play open sourced games, I haven't been able to revisit the world of Minecraft... until now
 
6:39 AM
I see. I don't play MC too often. Sometimes I mess around with computer mods. I'm sad that the new version of redpower makes recipes so expensive; it'll be a while before I can build a functioning PC controlled elevator and automatic farm. For now I've run a wire down into my mine so I can check the weather/time on the surface
I think the mine's ~600 blocks deep and 200 wide by now
 
@thepiercingarrow Is Minecraft open source now?
 
It's an MC clone
 
7:14 AM
Hi.
 
Ell
Crazy expensive
Decals are pretty cool, I think custom light is overkill
 
@Ell right I forgot people who buy Macs generally buy cheap stuff
 
i want a fucking pc rig
 
what's a pc rig
 
a pc build
 
8:00 AM
@Ell It's just a hole in the build
 
Would you want a ceo with a customized laptop?
 
@fredoverflow No, minetest is a reverse engineer attempt written in C++
(i think)
 
@ChemiCalChems IOW you just want money
@thepiercingarrow it's a clone, not a reverse engineering
 
@BartekBanachewicz i don't care about money, i want a pc
 
@BartekBanachewicz Oh, sorry. Whats the difference?
 
8:05 AM
but yeah I minetest made me stop develop minicraft and that was sad
 
@BartekBanachewicz What do you mean?
 
@thepiercingarrow reverse engineering attempts to find out the internals of the original. A clone simply attempts to look the same.
@ChemiCalChems You can convert money to a PC just fine.
 
Oh I see. Thanks!
 
in fact, that's how most of the people obtain their PCs
they obtain money and then buy a PC
 
@BartekBanachewicz i know, but i don't want to have money, i want a pc
 
8:07 AM
@BartekBanachewicz Wow. Nice.
 
it's not the money i look for
 
@ChemiCalChems Noone does really.
 
@BartekBanachewicz then case closed
 
it's always what you can buy with it
 
Fuck, man, they're not done yet hurriyetdailynews.com/…
 
Ell
8:10 AM
@slaphappy oh. How do they light up the "complex design"?
 
> “I want to guarantee that fundamental rights and freedoms and normal daily life will not be affected by this. Our citizens should feel comfortable about this,”
 
@Ell just like the apple?
funny, I'm looking at minicraft code and it's actually quite clean
 
nwp
@BartekBanachewicz why no license?
 
When your rulers tell you should feel comfortable about "suspending" a human rights convention.
 
Ell
@BartekBanachewicz how is that?
 
8:11 AM
How do you compare two doubles?
 
by comparing them
 
I heard you shouldn't use >, <, == on doubles
 
@nwp wat
@Ell screen backlight
@nwp I hereby grant you the right to use Minicraft code under BSD 3-clause license.
I must've forgotten
 
nwp
would be nice to add a license.txt or something
 
@thepiercingarrow that's a very TL;DR version of the "advice". which is also wrong
 
8:13 AM
@nwp no really :P
 
328
Q: Most effective way for float and double comparison

AlexWhat would be the most efficient way to compare two double or two float values? Simply doing this is not correct: bool CompareDoubles1 (double A, double B) { return A == B; } But something like: bool CompareDoubles2 (double A, double B) { diff = A - B; return (diff < EPSILON) && (-...

 
371
A: How dangerous is it to compare floating point values?

R..First of all, floating point values are not "random" in their behavior. Exact comparison can and does make sense in plenty of real-world usages. But if you're going to use floating point you need to be aware of how it works. Erring on the side of assuming floating point works like real numbers wi...

 
there, commited
 
I don't understand. So its perfectly fine to compare doubles?
 
@thepiercingarrow it depends
 
nwp
8:16 AM
@BartekBanachewicz cool thanks, I think I'll try it when I'm home
 
@nwp I am pretty sure it might be a hard to build after 3 years
Please fork off and note what changes you had to do.
Also Lundi is completely optional, you should be able to cut it out from dependencies rather easily
The project should move to Sol now anyway /cc @ThePhD
 
Still on the topic of human rights... hrw.org/news/2016/07/21/…
Ffs
It's like everyone's going "meh, those are just guidelines"
 
@BartekBanachewicz on what?
 
@thepiercingarrow on your use case, obviously
 
nwp
I've been doing C for a while and now I question the practice of returning string literals as std::strings instead of const char *. Maybe C is just not good for me.
 
8:21 AM
@milleniumbug what?
Okay I have two fractions
struct Frac {
  int num, den;
};
 
@nwp Having std::string allows you later to change it to a computation
 
I want to compare which one is bigger.
3
 
@nwp repeat after me: computers are fast
 
@thepiercingarrow you don't need FP for that
 
@thepiercingarrow let n = LCM(den1, den2) in return num1 * n / den1 > num2 * n / den2;
 
8:23 AM
is LCM even a thing?
 
...
no it's reptilian conspiracy
 
@BartekBanachewicz or you could just (double)num1/den1 > (double)num2/den2? /cc @thepiercingarrow
 
nwp
@BartekBanachewicz I know, and speed absolutely doesn't matter because it is an implementation for persistent flash memory on a microcontroller, but for a desktop pc that is ~1000 times faster.
 
@milleniumbug wow
 
8:24 AM
@milleniumbug Finally!
 
nwp
still it feels like I'm not writing the code that I intend to write
 
which way is faster?
 
@ChemiCalChems that's exactly what you're not supposed to do -.-
@thepiercingarrow code both and measure
 
@BartekBanachewicz why the fuck not?
 
@ChemiCalChems because you introduce FP math to a problem that doesn't need it
speed aside, it's more likely to be problematic
 
8:25 AM
@BartekBanachewicz it's the fastest way to solve the problem
 
@ChemiCalChems I am pretty sure my solution was before yours.
 
But was it final
 
Okay now I have to write a LCM function :/
 
@thepiercingarrow or just use one of the millions implementations on the internet
or std::experimental::tr3::wtf::omg::lcm
 
@ChemiCalChems Bartek's solution has as much precision as the original type (not quite, but it does if you add a few parentheses to it). Yours doesn't.
 
8:27 AM
are you being serious? running an lcm against dividing?
 
@ChemiCalChems imagine sizeof(int) = 8
 
@ChemiCalChems Consider that double cannot represent all numbers in a long long.
 
I'm writing this in C btw
 
@R.MartinhoFernandes oh, well
 
@thepiercingarrow then stop (drop, and roll)
 
8:27 AM
no one cares hth
 
that explains a lot
 
@ChemiCalChems In fact, double can only represent less than 0.05% of the numbers a long long can.
 
@R.MartinhoFernandes yeah yeah, i just thought about that
 
I love this percentage
 
do you know that double can only represent 0.049999999999999999999999999% of numbers
 
8:29 AM
@milleniumbug It's 2^-11
 
yeah, 2^(53-64)
 
Maybe the right value is 2^-10.
Not a big difference.
@milleniumbug You're including the sign in one but not the other, hence my correction.
 
@ChemiCalChems BTW floating point division on doubles is IIRC about 90-100 cycles. And you have to do it twice. LCM is log(n), which is linear on bits. It's not that obvious it'd be slower.
 
7 mins ago, by Bartek Banachewicz
@thepiercingarrow code both and measure
 
8:32 AM
@BartekBanachewicz fucking hell
 
@ChemiCalChems besides if you really want the fastest solution to code, just use num1 * den2 > num2 * den1 /cc @thepiercingarrow
 
@BartekBanachewicz true
 
Ven
also hi
 
Wut now I'm so confused
How am I supposed to write an LCM
 
@thepiercingarrow Divide their product by the gcd.
That's the simplest way I know.
 
8:41 AM
okay thanks
wait wtf?
to compar a/b and c/d
Can't I just compar a*d and b*c ??
 
7 mins ago, by Bartek Banachewicz
@ChemiCalChems besides if you really want the fastest solution to code, just use num1 * den2 > num2 * den1 /cc @thepiercingarrow
 
Oh :(
I actually thought I was smart for a second :(
 
in Documentation Public Beta, 25 mins ago, by Bartek Banachewicz
@JayIsTooCommon This might be the first time i agree with someone writing PHP unconditionally.
> Perhaps the way to economic equality is basic income, instead of having just one highly paid trade.
help I was exposed to terrible opinions on the internet
 
Ven
8:52 AM
I added valuable information to some popular topics! I'm glad SO exists.
 
I find basic income is soon going to be a necessity.
Jobs are not going to be a thing for much longer.
> Right now we need information, and blocking a ton of users out of being able to contribute effectively to build up our knowledge base is only going to clog up the system and lead to a poor experience.
"effectively"
 
nwp
@R.MartinhoFernandes I so hope you're right, but I fear they are gonna start enough wars and civil unrest to throw us back a couple of decades, keeping jobs a thing for a few decades longer.
 
@nwp Don't worry, wars tend to have the opposite effect on technological progress.
 
@R.MartinhoFernandes the rest of the article was way worse
I am not gonna link it here because I don't want you to get brain cancer
@R.MartinhoFernandes ITT robot is literally hitler ;)
 
@nwp And parts of Germany and Japan have been bombed to the Stone Age and yet they're some of the largest economies less than a century later.
@nwp The real problem with this is that you might not make it to the other side.
 
nwp
8:59 AM
yeah, I most likely got less than a century to live
 
if we could have wars without killing people
 
nwp
sit down and play a couple of rounds of starcraft
korea new superpower
 
also you can just do lcm on every modifying operation
as in, have it canonicalized as an invariant
 
Ven
lcm isn't easy to say out loud
:(
 
then you don't need to do it on every comparison
 
9:00 AM
@milleniumbug That really needs a ping arrow.
@nwp I also like to tell people that all the wars and genocides in the Balkans have solve the problem by creating a series of mostly ethnically homogeneous states (Bosnia notwithstanding).
Just embrace it :D
 
@R.MartinhoFernandes funny how stars are the opposite of arrows
arrows bring context, stars take it away
14
 
That's deep.
 
mind blown
 
OMG github recognizes Terra on its list of languages
there's a total of 5 repositories
 
9:15 AM
Super excited about #CppCon this year! https://twitter.com/CppCon/status/756197179237085185
yep CppCon is going to be awesome this year
aight, off to work now
 
nwp
is there something like git ignore path/to/some/file that writes the right thing in my .gitignore?
 
Xeo
lolz. Unreal breaks if you name a widget blueprint animation "Content".
 
Unreal is not content with this file
 
#gamedev
who wants to write a game in Terra with me
I'm super obsessed with this language and I need to fail at writing something in it
 
Xeo
Start by failing to start.
 
9:29 AM
@Xeo I am doing great so far
it's been 4 days of me not starting it so far
I wonder if I should not start it for longer or start failing now
so far I discovered that there's no resizeable data structure in Terra
 
how do you move an example to the top?
 
@ChemiCalChems it can be pinned or voted up
 
@BartekBanachewicz pinning it will move it up? ok
 
Ell
9:55 AM
@nwp alias echo realpath something > .gitignore
 
@Ell Quickly followed by git checkout -- .gitignore because you just nuked it.
@Ell Also, why realpath? Absolute paths in .gitignore sound very wrong to me.
 

« first day (2106 days earlier)      last day (2841 days later) »