« first day (4016 days earlier)      last day (918 days later) » 

1:32 AM
 
 
11 hours later…
12:33 PM
Why do tech companies implement features in herds?
Like this dark mode.
 
well bad code obviously
 
because their customers haunt them like an Asian parent "Have you seen that your cousin implemented dark mode?"
 
nah man i bet ya most asian parents dont even know what is it all about
yo my muscle memory sucks any body have the same problem
 
12:50 PM
If I have problem with memory, it's not with my muscles. Today I went to one department store and tried to use the card of another department store, because I mixed the two up.
 
 
5 hours later…
5:54 PM
Kinda dumb that int popcount(T x) returns an int instead of lets say, an unsigned int?
 
This works
https://godbolt.org/z/bbWvcPGoW
 
@Lapys didn't' read the conversation but capturing a const char* pointer is basically capturing a number (a pointer), it can be different across translational units so that it looks like foo<const char* ptr = x91209EAD> and foo<const char* ptr = xDECAFBAD> in another unit. Leads to some linking warnings, problems.
 
but look, it's a reference not a pointer 👀
oh wait.. those are the same thing

Well, it should be safe as long as the `char const[]` array objects stay consistent across translation units, right?
 
but you're going to make them inline or something?
 
Should I? 🤔
 
5:59 PM
use an enum
Machine<ACTIVE>, ACTIVE should be an enum and not a foot gun
 
Lol, yea 😅
Just wanted to demonstrate that string constants work, as well
(yet to see why it shouldn't since it's apparently as valid an object as an enum member)
 
there is another way to pack string constants, which is to pack them into a type with each letter part of the type
but ultimately, sure, those are pointers and a number to some location and you can hope the type carries the right address
 
The facilities for a convenient template <char...> pack seem a bit cumbersome, ngl 😕
@Mikhail Does the problem with using strings for the parameter also occur with using lambdas & PODs? (C++20 and up)
 
So, const char* strings are kinda pooled on a per translation unit basis so the pointer will be different for each translation unit.
Not sure if it answers the question, but the issue happens with any pointer in a template argument
now its possible to have a POD/lambda(?) template argument by value, then the linking issue goes away
 
What about a POD that only contains a string constant, lol...
wait, that kinda defeats the point
 
6:08 PM
template <auto foo = some_pod(1,2,3,4)> <- no linking issue
the string constant wrapper struct will be different, because the pointer const char* foo="something" is different in every TS
 
Wonder what a world with string constants for NTTPs would have looked like?
`enum`s would probably still be best practice
Seems like hashing with extra steps?
Oh, so not "hashing with extra steps"?
 
whats the actual problem you're trying to solve?
 

« first day (4016 days earlier)      last day (918 days later) »