« first day (3040 days earlier)      last day (1891 days later) » 

12:58 AM
Posting this, because small big cat hugging a small dog. <3
Like small big cat will grow bigger but dog reminds small.
Also I love peafowls - they are like chickens, but more interesting.
 
1:34 AM
So I'm pretty confused when to use std::thread or prthreads. It seems they both have the same methods/classes e.g. both have mutexes, condition variables etc.
I'm developing on Windows and using Mingw. std::thread isn't implemented on it yet but someone implemented it here github.com/meganz/mingw-std-threads but if I'm going to be using third party libraries anyways then doesn't that defeat the purpose of using std::thread?
If I'm going to be using third party libraries anyway then is there a better one to use?
 
2:28 AM
@northerner No, not really. Your code is following the standard, so the third party library is purely a temporary measure to make up for the shortcoming(s) of a particular implementation at a particular time.
@northerner Not to me knowledge--at least not right now.
 
3:20 AM
@northerner Use MSVC
 
 
1 hour later…
4:25 AM
@YvetteColomb How are you? Done and dusted with your fences?
 
5:01 AM
@JerryCoffin I still don't see that argument. The methods are the same for pthread so wouldn't it be just as easy to switch from pthread to std::thread as some github library to std::thread
 
The methods aren't the same, also pthreads doesn't have RAII wrappers
If you're using C++ you should be using std::thread
 
user3956566
5:22 AM
@TelKitty not quite. So tired :)
 
7:28 AM
@YvetteColomb Move fencing is a good exercise :p
 
8:26 AM
How likely is a star in our galaxy explode and kill us all with ultra high frequency electromagnetic waves?
 
 
1 hour later…
9:34 AM
@fredoverflow how is that controlled though? Because you wouldn't always want that to happen
 
I tried to implement a Sudoku solver. It has a stupid mistake that I cannot find :( Could anyone have a look at it?
 
I can try...
 
Hello, just a quick question : how would you name the function f(a,b,x)=(1-x)*a+x*b, with x between 0 and 1 ?
 
@thecoshman thx
 
And what exactly is the issue?
 
9:42 AM
" In aero (but really defense contractors) you see shit designs patched by exhaustive tests"

Hah that is how the SEI makes tons of money with consulting. I wonder how common this is in other non-tech companies.
It does not work
@thecoshman the first puzzle is actually solvable but it returns false.
 
@Nils quality bug report there
 
?
where
 
I'm saying that just saying "it does not work" is not really of of much use for debugging a problem
 
if you use a heap to insert and retrieve inside a list traversal that still linear correct?
 
@Annyo Linear function.
 
9:46 AM
@Rick Min / max heap is log IIRC
@Rick You are Rick you should know!
 
@Nils L82, where does n come from?
 
It is 9 (const) on line 9
 
@Nils What kind of mistake?
 
@TelKitty probably an idiotic one, as usual :)
 
I know it's logn to insert and retrieve but in conjunction with the list traversal, for every list item I have to do a lookup or an insertion
 
9:50 AM
@Nils That's not how you describe the issue to the technical crowd :x
 
@Nils well, that's (probably) not your bug, but fix that trash :P
 
Which trash?
 
having a constant 'n'
 
Wait is the canPlace method correct?
@thecoshman Would you rather like a command line option?
 
Also, :vomit: having out params
@Nils give it an ok name for one thing
Erm, do you just loop 0..9 and test, for each number, just once, if it can be placed?
I don't see how you handle you placing two of the same number into the solution
oh wait, via your recursion
 
9:55 AM
It should be:

int rowStart = (row < m) ? 0 : ((row <= 2*m) ? m : 2*m);
int colStart = (col < m) ? 0 : ((row <= 2*m) ? m : 2*m);
on line 61, 62
To check the sub squares, right, but there must be another mistake. Right?
Can you spot the other idiotic mistake? :D
 
It'd be easier to tell if you didn't have trash constants like 'm' just floating around
 
Line 62 where is the mistake?
 
@Nils why not just do integer division? row / 3
 
Correct is:
int rowStart = (row < m) ? 0 : ((row < 2*m) ? m : 2*m);
int colStart = (col < m) ? 0 : ((col < 2*m) ? m : 2*m);
@thecoshman Thanks would also be an option
have to go
 
you're using 0 index, right?
 
9:59 AM
yes
How do you get better at spotting idiotic mistakes?
 
rubber ducking is hard, you basically need to try to forget everything about your code and look at it as if it was someone elses
 
10:11 AM
@Mikhail ok thanks.
 
 
2 hours later…
12:07 PM
The more I fix bugs the more I find bugs T_T
help
 
user7659542
12:25 PM
it is said that one should always use uint8_t or int8_t when doing calculations with data that is 1 byte. And when somehow dealing with text it is better to use char instead. But in this case why do we differentiate signed and unsigned char? You ar not supposed to care as this is not for calculations
 
@Morwenn write more tests?
@traducerad Not sure who said that to you, but it's absolutely wrong in most cases.
 
@Mgetz I did when I realized there were bugs
When I released the previous version of my library I had 1 bug reported (stilll not fixed), and while working on the next version I found 10 more bugs and not even in new code x)
 
@Morwenn that both sucks and is depressing
 
I fixed 6 og them already
 
@traducerad ex of why fixed width types can massively hurt perf blogs.msdn.microsoft.com/oldnewthing/20170808-00/?p=96775
 
 
5 hours later…
5:19 PM
 
 
4 hours later…
user7659542
9:47 PM
@Mgetz i am afraid i don't see the link with my situation. Long story short I usually don't know whether i should be using signed or unsigned char
 
user7659542
Besides that i believe, based on what i read online, that (u) int_8t is only good for "numbers" and chars for text
 
@traducerad it's never mattered for me. In theory you can use it on systems you know are 8bit char to detect unicode or double byte
@traducerad my point was more that fixed width ints shouldn't be used just randomly, they can have very significant and negative impacts if you're not careful. Most RISC platforms for example don't really support anything greater or smaller than native word size without a lot of extra instructions.
@traducerad final semi-random point... in theory you should use the type corresponding to the character set you're using... hence the introduction of char8_t in c++20
also std::byte
 
user7659542
10:15 PM
@Mgetz are you saying that whenever you are writing software on a new piece of hardware you always check the generated assembly code to understand the impact? Even when writing in a highlevel language like cpp?
 
user7659542
Don't you end up spending more time reading asm than writing cpp if that's the case? The asm code varies quite a lot from hardware to hardware and is imo not always very easy to understand
 
@traducerad no, don't use fixed width ints unless you absolutely need to
 
user7659542
10:32 PM
Thing is, every project i have worked on so far used fixed width ints. At some point or another you will want to send that data to some other device using a given protocol. Having fixed width ints guarantees the communication /protocol won't be impacted if you eg migrate your software to new hardware whose "native" datatype differs. Time is money. As long as you meet the performance requirements linked to your product /project i think you d better stick with fixed width for portability
 
user7659542
@Mgetz
 
@Mgetz If only there were any consequential RISC platforms left.
always use fixed-width ints, really
 
@Puppy ARM, MIPS, RISC V
let's start there
 
the trivial alleged performance benefits are nothing compared to the vast maintenance benefits
ARM is far from a RISC platform, they introduced a dedicated instruction for JS number conversion..
 
user7659542
@Puppy this
 
10:41 PM
@Puppy so causing four instructions to be issued instead of 1 for every single operation...
ok then....
 
ah yeah cause adding fixed-width integers that aren't pointer-size is every single operation?
program efficiency is dominated by algorithms, and then I/O or even memory accesses.. raw number crunching efficiency is far from the common case
 
I'm going to 100% respectfully disagree
I think that's over optimizing and misusing language constructs
 
if raw number crunching efficiency was really important, VM-based languages would never be useful
 
my point is that in most cases int is good enough
 
it's certainly not
 
10:45 PM
fixed width has a very specific place in serialization
or when you know you have numbers that are of a certain size
 
the last thing you want is to accidentally find out you used some type in a persistence format or interface that you can't change and you broke shit
 
30 secs ago, by Mgetz
fixed width has a very specific place in serialization
 
or that your program behaviour changes because you accidentally underflow/overflow
@Mgetz Serialisation is far from the only place where you need width stability
 
@Puppy I have yet to have that ever be an issue
 
user7659542
@Mgetz what if you run your software on 32 bit and want to migrate to 64 bit? You're communication interface will be broken
 
10:46 PM
for instance, I seem to recall that there are some older APIs that couldn't be used from some compilers, as they name mangled it based on the type, and they had different widths in different implementations
 
@traducerad you seem to be ignoring that I'm not saying don't use I'm saying use them when fixed width absolutely matters
if the case doesn't have any benefit from fix width... there is no point
 
union Crap { struct S{ int16_t one: 8 int_16_t two_big_endian: 16} , int8_t[4]};
 
fixed width mostly always matters more than trivial performance benefits that you probably couldn't even measure
 
@CaptainGiraffe technically UB
 
if the case doesn't have a profile proving it's a performance hotspot, use fixed width
and even then seriously think twice
 
10:48 PM
@Mgetz not technically, also implementation defined. Got bit by this last week.
 
@Puppy really so for(int32_t i = 0;??
really
 
yeah
 
@CaptainGiraffe Type puning via unions is technically UB AFAIK. Implementations usually define it though
 
@Mgetz ISTR that GCC has an option for it and MSVC always allows it because they tried disabling it and it turned out they have 1mloc of code that relies on it or something like that
 
@Puppy I'm going to agree to disagree, I think that's a seriously flawed approach
@Puppy MSVC can't because a little code base called Windows NT relies on it
 
10:51 PM
@Mgetz It became a case of "It worked on my machine". I made the verdict don't write this crap.
 
@CaptainGiraffe I'm aware, my point was more that bringing something that's UB into the discussion doesn't really help
the sentiment usually comes down to serialization or security safe code
but in cases where you're holding simple indexes etc.... don't need fixed width
 
@Mgetz Understood. I'm still bitter about that piece of API code though.
 
and the memory savings from using smaller fixed width isn't worth the cost
 
@Mgetz You're wrong about that too.
bit the C# and Java guys
 
@Puppy I've already agreed to disagree
 
10:53 PM
.NET has to have "Length" and "LongLength" now
and Java has something similar if I recall correctly
 
@Puppy I'm not saying to lock it out like they did
I'm saying that in most cases it's fine to not use fixed width and probably better
 
but int is locking it out, because there's no guarantee that it's pointer-sized which is what you truly want
I mean, in this case it's fixed width if not fixed to a literal constant
 
@Puppy pointer size actually isn't what I want in 90% of cases because it far over represents the usable range
size_t doesn't make sense beyond char
 
people always think that and then
 
and what?
 
10:55 PM
and then it turns out that people want arrays of more than 2 billion items
 
@Puppy and in those cases use fixed width... but in the 98% of cases that don't require that...
 
it's a fine example because the people did not recognise it was one of those cases until it was far too late to fix it
if they had just used a proper fixed width from the beginning then it would never have been a problem
 
@Puppy except we're not talking about Java or C#
we're talking c++
 
C and C++ programmers have made exactly the same mistakes
 
and?
 
10:56 PM
just not typically in the Standard library where they used fixed width for such things
 
@Puppy actually they didn't
 
last I checked, std::vector's index is a size_t
or something equivalent to that anyway
 
sizeof(void*) != sizeof(size_t) under the standard
it can be
but it's not required
and honestly if you look at the committee they largely consider using size_t a mistake there, they should have used ptrdiff_t
 
they overcomplicate things a bit to support different memory spaces and stuff
really size_t and ptrdiff_t should always be the same type
but ptrdiff_t is still fixed size so
 
my point is that in 98% of cases... the default int is fine
@Puppy they will NEVER be the same type per the standard
ptrdiff_t MUST be signed
 
11:00 PM
the default int is fine until you realise that you totally fucked up and it actually did matter, but now it's too late to fix it and you weren't in the hot path anyway and had a problem for nothing
 
I think you meant they will have the same width? That is also incorrect
@Puppy so overengineer everything?
that's a garbage approach
 
using fixed-width isn't overengineering, it's just engineering
micro-optimising with trying to play games based on hoping your compiler will give you some trivial performance you'll never notice is overengineering
 
no it's overrengineering, and in most cases actually an anti-pattern in my opinion
@Puppy on the contrary, I'm not optimizing at all. I'm using the default, you're trying to optimize for edge cases that in most cases don't apply
 
I meant that in a cleaner version of the Standard, there only really needs to be int and unsigned int in 8, 16, 32, 64 (maybe 128) and sizeof(void*)
not that they're defined as the same in the current standard
@Mgetz But by the time you figure out if it does apply, it's often too late, so it's often wise to optimise up front.. (also the default can be and often is wrong)
 
I sorted out the location voting for Uncon!!! Yay, I'm not a complete failure in life
3
 
11:03 PM
@Puppy so in some places (interfaces because of ABI, serialization, security sensitive code) it makes 100% sense. But in places those don't apply, it's an overoptimization.
 
cause people never, ever make mistakes in applying those rules, no sir, and when they do make those mistakes, they sure don't last for years or decades
there's a difference between an optimisation and making sure you don't run into critical maintainability problems
my position has nothing to do with performance of any kind
 
Whereas I feel like you're trying to solve for problems that don't exist yet, I can't solve for 256bit computing and the ABIs for that
 
the default would be less silly if it was required to be pointer sized, at least then you would know all implementations agree
 
I sincerely hope my APIs aren't being used then
@Puppy except they don't
 
the COBOL guys called, your APIs will certainly be being used then
 
11:06 PM
Someone slap a star on the bad boy please
 
on IBM mainframes sizeof(void*) == 128
and they are standards compliant
to be fair you can't access 128 bits
 
user7659542
Never realised fixed width vs variable width could become such a debate
 
half of that pointer is permissions and other stuff
 
uh
are you saying that the pointer contains the permissions?
 
@traducerad you don't know the pain of porting code to a new platform
 
11:07 PM
so you can just.. mutate your pointer and give yourself any permission you want?
 
and clearly nearly does puppy
 
user7659542
@Mgetz guess why i am pro fixed width... Imo that's to some extent already a reason for going fixed width
 
@Puppy can't say I think they are opaque
 
I know the pain, and using variable width increases the pain since your integers randomly change size instead of being how you originally wanted them to be
 
@traducerad irony.. I'm for the opposite reason, because I've seen people assume widths and gotten burned on it whereas if they had just used the right types in the first place it would have been fine. I know that sounds like I should favor fixed width... but they were over engineering.
either way I'm out for the day
peace
 
user7659542
11:11 PM
Night
 
me too
 

« first day (3040 days earlier)      last day (1891 days later) »