« first day (604 days earlier)      last day (4345 days later) » 

5:00 PM
ONLY THREE MINUTES TILL I GO TO BED AND GET READY FOR SCHOOL NEXT MORNING
 
If Google thinks a site might be an attack, why do they put it in the first few results?
 
and bam. I run into the cout << int8_t(5) C++ hell.
This really, really, really sucks ass.
 
Seriously though, goodnight. Perhaps the next time I come back I'll have a bronze c++ badge. Till then!
 
@BoltClock Good night.
 
Remember to cast your votes over the next week! :D
 
5:01 PM
Has it started yet?
 
@BoltClock I'll do one better and dynamic_cast
 
@RMartinhoFernandes It starts in another 2 hours I think
 
Ok, thanks.
 
so the candidate moderators are asking for votes huh? and being nice and shit?
 
@rubenvb Eh, that's what elections are about
 
5:04 PM
What was that about comments and flagging and vomit and stuff?
 
"I promise to wipe my arse of all the shit I do, and I also promise to be super-nice to everyone and solve everyone's problems. Disclaimer: not all promises actual promises."
 
I go to the shop and miss all the fun. Dammit.
At least I have food now.
 
Some elections are about: hey, there's only one candidate. Thanks for your support :)
 
Is there a reason why dynamic linking could result in faster code than static linking?
 
@Mysticial Microsoft.
 
5:06 PM
no, not really
 
@rubenvb He's not a candidate. He's already a mod.
 
I have this strange situation right now where static linking runs 2% slower than dynamic linking... wtf...
 
@RMartinhoFernandes but he's rerunning for office right?
 
@rubenvb This is for life.
 
@rubenvb lol
 
5:06 PM
There's no rerunning.
 
@Mysticial Yes, this was an issue at Apple in the early days of OS X.
 
oh, heh didn't know this.
 
Leave it to Apple to screw up static linking.
 
Quick question, if I set chmod o-x on a directory, can other users still perform a directory listings on nested directories of said directory if they guess the nested path name, or are these permissions inherited?
 
@Potatoswatter I'm on Windows. hmm...
 
5:07 PM
The OS plays all kinds of games with VM and caching, and dynamic linking gives it leeway to optimize more.
It's gonna be the same either way. This was like 8 years ago.
 
@Potatoswatter he is experiencing it now.
 
@KonradRudolph I knew that once, but don't remember now. Try it. :P
 
@CatPlusPlus Unfortunately, I can’t easily :(
 
@rubenvb Maybe he time-travelled.
 
I think it might prevent it.
 
5:08 PM
I have 2 libraries. One is statically linked in one build and dynamically linked in the other. The other library is dynamically linked in both. 90% of the run-time is spent in the library that's dynamically linked in both...
lol
 
I’d have to install a Linux system on which I can create accounts in order to test that myself …
 
@Mysticial Probably just between-runs timing variance.
 
I mean, such optimizations were state of the art a long time ago, so it's safe to assume the major platforms are the same.
 
oh, if there's multiple dynamic libraries involved, it can get tricker
 
5:09 PM
@DeadMG That's what I'm thinking too. Originally I had about 10 consecutive runs that favored dynamic linking.
Now they just inverted...
 
Download any LiveCD and put it in VM.
 
@Mysticial that's bad measurement. Idiot.
 
for example, if you have dynamic library X and Y and both link to library Z, you can save icache and such things by dynamic linking Z
 
Possibly Gentoo install CD, as it's like 50MB or something.
 
@CatPlusPlus Yes, that’s what I wanted to avoid by asking here ;)
 
5:10 PM
@rubenvb watch the name calling
 
room topic changed to Lounge<C++>: a beacon of sanity in the sea of vomit that is the C++ tag [c++] [c++11] [c++-faq]
 
@rubenvb That's what it's looking like right now. :)
 
I'm too lazy to Putty today.
 
@CatPlusPlus I don’t even have a VM installed, and VirtualBox requires a restart for installation :/
 
I have a VM. Lemme try.
 
5:11 PM
If in doubt, use ACLs instead of crappy Unix permissions.
 
@MooingDuck He knows I'm kidding, I hope. Right, @Mysticial?
 
@rubenvb :)
It takes a lot more than that is offend me. :)
 
@FredOverflow Yay!
 
eh... now the timings are all over the place...
too many background programs. lol
 
@Mysticial you're not measuring it correctly.
 
5:13 PM
@rubenvb Turbo throttling seems to be in affect...
 
@KonradRudolph Seems inherited.
 
my chip was running at 90+C for a good part of the test run.
 
@CatPlusPlus Hmm, that might actually be good advice, will look into that
@RMartinhoFernandes Thanks. My VM & LiveCD downloads are still running ;)
 
@Mysticial turbo throttling?
 
@rubenvb throttling of Turbo Boost
 
5:14 PM
can I initialize two int8_t's from a int16_t in a constructor's initializer list?
 
> Similarly a comment saying that a candidate has support from a chat room that has been featured on MSO in a negative light a few times (unfairly most of them, imho), can also poison perception
 
My laptop is supposed to turbo from 1.6 GHz to 1.73 GHz. But whenever it overheats or I put it under a heavy floating-point load. It stays at 1.6 GHz.
 
WE'RE TOUGH AND WE DON'T CARE.
4
 
Fuel : throttle :: air : choke. Turbo operates on air, not fuel.
 
@CatPlusPlus You're not tough, you're fluffy.
 
5:16 PM
like: Integer(int16_t i) : first(reinterpret_cast<int8_t*>(&i)[0]), second(reinterpret_cast<int8_t*>(&i)[1]){}
 
I'm tough in a fluffy way.
 
I understand this is wildly ugly code, but hey, I'm interpreting an int16 as two int8's...
 
you say that
 
@rubenvb Don't bother with reinterpret_cast. Gains you nothing.
 
@RMartinhoFernandes so, what. static_cast?
or C cast?
 
5:16 PM
Bitshift, dammit.
 
Cast to unsigned and shifts.
 
Also, no objections/comments/whatnot to the question guide?
 
But I need to be able to get an int8_t and N-1 uint8_t's from say an int64_t too.
 
Mod was here and I'm still not banned, so it's good, right?
 
I thought perhaps using some pointer array initialization stuff.
 
5:17 PM
@CatPlusPlus no objections from me, don't have any suggestions either
 
@rubenvb Same thing.
 
@RMartinhoFernandes in a generic way.
 
@CatPlusPlus why would anyone in their right mind ban an innocent fluffy animal?
 
@rubenvb If you want to treat int8_t like a regular integer with stream insertion/extraction, see 27.7.3.6.2/1 and call the facet directly.
 
Bitshifts are generic.
You can bitshift recursively to split a thing into smaller things.
 
5:19 PM
ahh.... My laptop's turbo boost is making it impossible to get consistent benchmarks
 
@Mysticial lock the CPU speed with... something.
 
Just make helper traits mapping size to type, and halve the size on each run, until you get to 1.
 
@CatPlusPlus I think it's fine. We can always fix it latter if an issue arises.
 
You mean delicious tears.
 
@rubenvb (some_uint64_t << (56-N*8) >> 56) or something, gets you the Nth byte
 
5:19 PM
@rubenvb I can't on my laptop. It doesn't have the fancy BIOS features of my OC'able machines.
 
@Mysticial Windows power management -> advanced-> max CPU speed
 
@CatPlusPlus That as well.
 
Or (some_uint64_t & (0xFFULL << N*8)) >> N*8).
I like that spells full.
 
@RMartinhoFernandes isn't it possible to copy an array of bytes starting from the second byte?
 
@rubenvb memcpy.
 
5:21 PM
huh!?
 
@RMartinhoFernandes in a constructor's initializer
 
@rubenvb memcpy in a stick lambda.
 
pair-of-iterator as pointer and all that?
 
@rubenvb I've played with that before, Windows has a tendency to ignore it a lot of the times. Right now it's set to 100%, but the CPU still occasionally clocks it self to 2.66 GHz under single-core load.
 
@RMartinhoFernandes Why bother with ULL?
 
5:22 PM
So it fluctuates between 1.6 GHz and 2.66 GHz... eh...
 
@Mysticial I would suggest turning it down to say 30%
 
@DeadMG Because it's int by default and shifting will overflow.
 
@rubenvb Then it'll take half an hour to compile anything.
 
Signed shifts are weird.
 
@RMartinhoFernandes oic
 
5:22 PM
The nasties that is.
 
I need a new laptop...
 
Use cachegrind?
 
Also, aftermath of wiki cleanup: 44 pages reduced to 29.
 
@CatPlusPlus what did we have 44 pages dedicated to?
porn?
 
5:23 PM
oh boy
 
@CatPlusPlus What kind of crap did you nuke?
 
you and your porn
 
on no, I've got Johannes on my case
 
@Mysticial for the DLL vs static test. No need to compile anything??
 
I only ever saw the wiki newbie hints page
 
5:24 PM
Hmm, I think I have better docs for wheels on the wiki than on the repo itself.
 
i don't wanna be on your case
 
Are you new here? Do you have a question? Read this first.
 
Can I enable_if a non-template constructor?
 
Yes, but obviously only as an argument.
Which is fugly.
 
5:27 PM
@rubenvb No, enable_if only works if its (innermost) context is templated.
 
cause my Integer<1>::Integer(int16_t) makes no sense...
 
Delete it?
 
where 1 is the number of bytes used to represent the input.
 
@rubenvb no you cannot
 
@CatPlusPlus you should embed that into the other one, so we don't loose two places on the starboard on newbies
 
5:27 PM
No? Huh.
@TonyTheLion Hmpf.
 
@TonyTheLion Newbies are worth it. Wait.
 
@rubenvb hiuh? why did you write it if it doesn't make sense?
 
@CatPlusPlus We'll need to merge that with the newbie hints next time the pinned message falls off the sidebar.
 
@rubenvb Don't enable_if. Static assert is perfectly fine there.
 
@JohannesSchaublitb it only makes sense for template arguments larger than 1.
 
5:28 PM
@rubenvb why is that?
 
@rubenvb static_assert.
 
why does it make more sense for 2 than for 1 ?
 
If you are new here, please read the newbie hints and keep the acronym list under your pillow. Also, read this before asking any questions. Thanks.
14
@EtiennedeMartel Hell if I'll remember about that.
 
@JohannesSchaublitb Because obviously a 1byte integer can't hold a 2byte value.
 
I still need to compile the DLL. And it takes several minutes to link. I'm not actually running benchmarks right now. But I was testing my new build scripts and noticed that static was slower than dynamic.
 
5:29 PM
What do you prefer: "sizes are the badz" or "overload not found <TL;DR ginormous list of candidates"?
 
@DeadMG no you misunderstood my question
 
@JohannesSchaublitb because for 1, I only have one int8_t, in the case 2, I have one int8_t and one uint8_t, which is fine for a int16_t.
 
@CatPlusPlus There.
 
@DeadMG When can we see the spec for WIDE?
 
@RMartinhoFernandes I get this with a static_assert:
Integer.h: In instantiation of 'Integer<N>::Integer(int16_t) [with long long unsigned int N = 1ull; int16_t = short int]':
main.cpp:7:33:   required from here
Integer.h:17:91: error: too many initializers for 'int8_t [0] {aka signed char [0]}'
Integer.h:19:5: error: static assertion failed: bla
 
@Drise You can see the existing partial spec at the site which robot will link soon enough
 
@rubenvb so "2" is number of bytes?
 
So the assert "works", but only secondly.
 
@DeadMG "soon enough", lol
 
5:31 PM
@rubenvb why does it matter whether there is a "int16_t" ?
 
@RMartinhoFernandes Some unused template thingies, silly user pages nobody cared about, and daknok's half-deleted project pages.
 
just leave it alone and convert the parameter to a int8_t afterwards
 
That's terribly inconvenient to do in the constructor's initializer.
 
@rubenvb sorry i somehow missed the bytes thing. thought you were talking about bits
 
@CatPlusPlus I has a problem. (Re: Asking Questions). You start your numbering at 0. But you start your sub-numbering at 1. Whhhhyyyyyy?
 
5:32 PM
@SamDeHaan Because.
 
because 7 8 9
 
arggg
F-U C++
 
@rubenvb so you can just declare an "int" param ctor and remove all other ctors
conversion from bool to int goes fine.
 
@CatPlusPlus Oh. Of course.
 
@JohannesSchaublitb yeah, maybe that's easier :) Being too pedantic on types I guess.
 
5:33 PM
@rubenvb in c++11 you can make it a template with a default param tho
 
@rubenvb What do you want exactly?
 
#0 emphasises "this is not part of the rules, but is important thing to remember". Or something.
 
Integer<1> x(int16_t(10)); to compile, or not?
 
@RMartinhoFernandes well, no.
 
@rubenvb i found it's not worth it. in my libs i usually declare the {uint, int, ulong, long, ulonglong, long long} overloads and they will accept any integral types possible
 
5:34 PM
If you don't want it to compile, you're done already.
 
@RMartinhoFernandes OK so you cannot just have an int overload then
 
Unfortunately GCC fucks you over and shows extra errors before the static assert, but well...
 
yeah, I guess.
 
but why do you want Integer<1> x(10) to fail
that'S going to cause pain
 
But I agree with Johannes that this might not be a good idea.
 
5:35 PM
@JohannesSchaublitb I want Integer<1> x(int16_t(10)); to fail
If a user needs to throw all the high bits overboard, he should cast, not me.
 
@rubenvb But Integer<1> x(10) will fail as well no? (It's an int).
 
there is no way I see why that should fail but not "10"
 
@RMartinhoFernandes yes. That's a side effect.
In all honesty, you won't be using this class for small integers
 
Make it a template and enable_if :S
 
5:36 PM
@RMartinhoFernandes That would perhaps allow it to work for constants wouldn't it?
 
perhaps you want users to not use the ctor and instead say 10_integer
 
Alternatively, factor out the ctors to a template base class with specializations and inherit them.
Sucks that GCC doesn't have inherited ctors.
You can fake them, though.
 
not completely
can't forward init lists
 
@JohannesSchaublitb Yeah, but well enough for this case.
 
Word y u need to try highlight for me.
 
5:38 PM
Clang also spews the extra error :(
But I'm going to fix the output first :)
right now cout << Integer<2>(std::int16_t(128)); outputs -128.
 
@CatPlusPlus I thought it emphasized that we're cool, and like 0-based counting.
 
now I want the ostream stuff to be a template I can enable_if
 
BTW quiz!
what is a non-template function!?
 
/me fails quiz.
 
5:42 PM
@JohannesSchaublitb A thing!
 
A... function?
 
A function not instantiated from a template…
 
@rubenvb but a template already is by definition not a function!
@Potatoswatter ah that may be it!
 
But, in my book, friends instantiated from an unrelated template don't count.
The Standard doesn't draw any such distinction, far as I can recall.
Perhaps the most Standardese way of putting my opinion is that a non-template function is a function with no template-id.
 
5:47 PM
i recommended that there be a definition in clause 1 for it
 
how do I declare a friend free function that is a template and specialized outside so i can enable_if the sucker?
 
"A function that is not a function template specialization."
 
THis:
...
friend std::ostream& operator<<(std::ostream& s, const Integer<N>& i);
};
template<size_t N>
typename std::enable_if<N==2,std::ostream&>::type
operator<<(std::ostream& s, const Integer<N>& i)
...
 
ain't working
I get a linker error
If I templatize the friend with size_t NN, I get ambiguous overload and both things compete.
 
5:48 PM
because the friend is a better match because it's a nontemplate
you need to put the whole SFINAE magic into the friend declaration
 
37 secs ago, by rubenvb
I get a linker error
 
then you can just aswell define the operator too
 
ok, so move everything into the class?
 
@rubenvb why are you quoting yourself?
 
@rubenvb Those two are not the same. One is a template, another isn't.
 
5:49 PM
if you would not use the function, you would not get a linker error
@rubenvb yes everything needs to be in the class as a friend definition
(or declaration, but then you have the SFINAE repeated, bad)
 
@JohannesSchaublitb you say competing, I say linker error. You're not linking your answer to the right message I think.
@RMartinhoFernandes Yeah, I understand that now.
and then I need to make it static?
 
@rubenvb I don't link messages
 
Otherwise it operator<< has three parameters.
 
No. Keep it friend.
 
5:51 PM
@JohannesSchaublitb apparently :)
 
what I am saying that the friend declaration is preferred
because it's a nontemplate
 
ok
forgot friend
 
friend makes third parameter go away.
weird
Clang program segfaults, GCC works fine, hmmm. Let's see what ideone says :)
 
5:53 PM
look at me reinterpreting integer arrays
I'm proud of myself
 
You shouldn't.
What about endianness and shit?
 
@RMartinhoFernandes bitshifts have the same problem, no?
 
oh.
 
Bitshifts are numerical operations.
 
5:55 PM
no-o-o-o-oh
 
Oh, nevermind.
 
@RMartinhoFernandes what line?
 
just &0xff
or make an union
 
@JohannesSchaublitb won't that be UB?
(not that my current solution is any better)
 
If you use a char array, no.
 
5:58 PM
@rubenvb same effect as in your code
 
But it doesn't solve endianness issues.
 
if int8_t is char, there will be no UB
@RMartinhoFernandes it does
wait!
 
Isn't writing to one, then reading from another union member UB?
 
No, it doesn't.
 
5:59 PM
@rubenvb No.
 
@rubenvb not necessarily
 
(I dare you to find such quotation that means that)
 

« first day (604 days earlier)      last day (4345 days later) »