« first day (718 days earlier)      last day (4239 days later) » 

12:00 AM
Whenever I smell the need for unions, the unions get declared first, then they go into packed structs, then the structs become templates and/or data members. Yes, I know this is difficult/impossible with many translucent/opaque libraries.
 
@MartinJames whenever I think I need a union, I use boost::variant
that might be the first time I wrote it right and not boost::varaidic
 
Untagged unions are bad.
 
@MooingDuck Ugh! 'boost::varaidic' - lol
 
Which is to say C++ unions are bad.
 
12:02 AM
@MooingDuck boost::capoeira?
 
Why are C++ unions bad?
Did like
something happen with them or something?
 
Because they're untagged. Duh.
 
because they're untagged?
 
Because they are not tagged
 
Do they screw up projects?
Er.
 
12:03 AM
@ThePhD yes
 
... Tagged?
 
@ThePhD You like undefined behaviour?
 
@CatPlusPlus Not when you suddenly realise you need a union during development/debugging. they're not.
 
Y'all need to drink more.
@MartinJames What?
 
12:03 AM
@ThePhD Type discriminator to protect against UB
 
#include <boost/variant.hpp>
 
@MartinJames yes they are. boost::variant.
 
@CatPlusPlus I'm doing my best!
 
I haven't used built-in union in years.
 
Well I don't plan on using anything but standard, primitive types in my unions, so I think I'm on the more-defined side of the UB fence.
 
12:04 AM
@ThePhD wrong
 
Nope.
 
I give up. =[
 
I have never used 'raw' unions. (Well maybe in a legacy C codebase, once)
 
Don't use untagged unions. It's that simple.
 
12:04 AM
@CatPlusPlus You need to do more embedded and/or protocols. On second thoughts - you should avoid embedded/protocols.
 
@MooingDuck You broke it.
 
er, when did ideone go down?
 
Wow.
Offline for maintenance.
 
@MooingDuck > Ideone is currently offline for maintainance.
 
@MartinJames If you do protocols with type punning, you're an evil person.
 
12:05 AM
He broke it, with his template metamagic.
 
And I don't give a fuck about embedded, true.
 
@ThePhD anyway: wrong. primitive types in unions are just as easy (maybe easier) to get UB
 
Q. Why did the compilater go down?
A. It was just so horny
 
OK that makes no sense and seems to have come from Tony
 
Tony hacked sehe's account.
 
12:06 AM
Oh wait, I get it now
 
union { int a; float b; } x; x.a = 42; frob(x.b); // UB
 
@CatPlusPlus Sure I'm evil, but my code works well/efficiently.
 
If you want snippets.
No, it relies on UB.
It's not ~Good Code~
Therefore you suck.
 
AND JELLY
 
@CatPlusPlus I do not unionise floats and ints! I may be eviil, but not stupid.
 
12:08 AM
... I unionize floats and ints.
=[
 
@MartinJames Oh, I get it, you unionize int with int (signed, yours truly)
 
Untagged unions are not type safe, therefore code using them is bad.
 
what ever happened to the Kyrostat project?
 
AHahahaha
It died.
 
12:09 AM
Nothing
 
@ThePhD Well, I hope you pay your dues.
 
About a week after it was set up.
 
@R.MartinhoFernandes Too much anti-joke cat for you
 
Basically, nothing happened. Repeatedly
 
It was a setup
 
12:09 AM
You all suck.
 
@MartinJames They'll never take me alive. once I finished my library I'll hide its implementation in a bunch of CPP files.
Nobody will be the wiser. I'll infect the world with UB unions.
 
I did BB, build system, even tutorials on how to use Mercurial properly.
And IRC and mailing list.
 
UB-40, wasn't that infecting the world with unionists?
 
@ThePhD Now I'm absolutely sure I'm pissed.
 
And then Dom was supposed to make a forum and then it died.
 
12:10 AM
I wrote unicode shit!
 
unishod
 
@R.MartinhoFernandes I'm trying to write Unicode shit. I'm at least one step behind you, which by the sound of it, is just as well..
 
@MartinJames At least
 
I'm going to build a UTF8 parser.
 
Wut
 
12:12 AM
Because UTF8 seems the easiest to get my head around.
 
That doesn't make sense
 
? parse UTF8?
 
some process is launching a bunch of cl.exe and compiling hundreds of projects and I can't figure out how to kill it :(
 
Well, decoding is bitparsing.
 
I guess I should have said decode
But, parse a UTF8 bitstream
 
12:13 AM
Shut up cat.
 
Decode a UTF8 bitstream.
 
I fail to see much difference between parsing and decoding
 
Hahaha
 
What's the goal?
 
"deserializing"?
 
12:13 AM
@ThePhD "I'm going to use a string, once, when I grow up"
 
@moo context, basically
 
@MooingDuck Level of abstraction
 
@MooingDuck 'End process tree'
 
@MartinJames did that. lots.
 
Use UTF8 in my game and also have my regular std::strings so I can pass them to the LPCSTR for hwnd and stuff
 
12:14 AM
FWIW the easiest encoding to wrap your head around is utf 32
 
waaaaiiit
 
@MooingDuck Oh dear..
 
I killed the instance of visual studio I was using...
so the deveng.exe that's still in the taskmanager must be the culprit!
 
@R.MartinhoFernandes Takes too much space on my embedded systems. UTF16 for me!
 
@R.MartinhoFernandes True enough. And that's enough to make baby DeadMGs cry
@MartinJames Can't argue with the 'head-wrapping-effort' claims
 
12:15 AM
That space argument is bullshit
 
@MartinJames UTF16? Why? Is there any reason for that encoding?
 
What are you handling? The library of congress?
 
@MooingDuck deveng.exe is the virus (devilishly engineered)
 
UTF-16 is pretty much useless.
 
@moo windows
 
12:16 AM
Moo.
 
@R.MartinhoFernandes oh right. And I work on windows. wow.
 
@MooingDuck Also, LE or BE <grin/>
 
@MooingDuck It can represent all the chars I'm going to use and can be indexed.
 
@MartinJames UTF16 is variable width, so no indexing
 
It's fixed width for BMP.
 
12:17 AM
If space is low use scsu1 not some utf
 
But then it's UCS2, not UTF16.
 
@CatPlusPlus true
 
@MooingDuck Not how I'm using it.
 
Well, you can index it. Alright, just no linear random addressing
@MartinJames <cough/>
 
@MartinJames If you don't expect the code set you're receiving to go above 16 bits, you can just straight-index. Otherwise, shenanigans.
 
12:18 AM
So stop making stupid "i am using be wrong tool for the job because I don't want to use the arrive tool" arguments
 
Chuck Norris uses the implementation defined behavior exclusively to achieve code obfuscation
 
@thephd then why the fuck are you dealing with unicode if you are not dealing with unicode?
 
@ThePhD I control every character that is used in my system. I don't receive messages with any other encoding.
 
Chuck Norris can index UTF8 without shifting a bit and without using a lookup table
 
You cannot index anything in unified text
Unicode
 
12:20 AM
@MartinJames So, you're not dealing with UTF16. You're dealing with your own privately-held charset/encoding
 
Combining characters ftw
 
No, that's UCS2.
UTF16 without surrogates.
 
@sehe Restricted set of Unicode/BIG5.
 
Yeah. Moving goalposts are a restricted set of goalposts too :)
 
Also, indexing into text is pretty much a worthless operation
 
12:22 AM
Depends on design. Rationale: for scalability, look at chord-like design instead of single large buffers to represent text. Abstract away search/replace. End up being slow and bloated like the word processor near you. Profit
 
Name a good use for indexing into text.
 
Well, for indexing, perhaps. Like, keyword indexes; Source code location with AST elements... just thinking aloud
 
That works with any encoding
 
@R.MartinhoFernandes Why worthless? I have this dictionary of 234 strings in 17 languages. I have to address them with one byte.
 
I am talking about the kind of random access that people always say you can't do with utf 8 or 16
 
12:27 AM
@MartinJames that's not indexing into text, that's indexing into an array of text strings
 
Because if you search for a keyword in a string you can just note the index where you found it, regardless of encoding (except maybe for system ones)
 
@MooingDuck Yes, it is. Told you I was pissed.
 
Stateful, not system
Dammit
 
Pro tip:when fixing a bug in a DLL, make sure that your test program actually loads the DLL that contains the fixes, not some older copy :-|
^ Thought of the duck when I saw that
 
12:31 AM
If anyone wants more sordid details, the strings are in SD-card files, I have only 32K of RAM, (most of which is full of stacks and other shit), and the strings have to be read in real -time and distributed to 16 peripheral controllers :((
 
Stop writing for shitty hardware.
 
@sehe Hands up anyone who has not gone thorugh DLL hell.
@CatPlusPlus Shitty, but cheap, hardware.
 
@MartinJames That's not my definition of DLL hell. My definition of DLL hell is conflicting dependencies and ABI breakage with that. Add in a little WinSxS and manifest and enjoy
 
Can you play games on that?
NO I DONT THINK YOU CAN
Useless.
 
You can probably play pong
 
12:33 AM
With the hardware.
 
@sehe DLL hell - zlib.dll
 
@MartinJames That's a fine sample, though I don't exactly recall the problems. It's probably just the API changes that cause it to be a 'bad citizen'
 
The only DLLs I ever had problems with were CRT DLLs and cygwin1.dll.
 
@R.MartinhoFernandes Pong? Over the serial debugger link or on the 4*24 line LCD displays on the controlelrs?
 
@CatPlusPlus Those. True.
 
12:35 AM
"There is cygwin1.dll in memory somewhere already! Isn't that awesome?! Oh, and by the way, it's a different version than I expect, so I'll just shut down. Fuck you and have a nice day."
 
@sehe I can't remember the details either. It's like asking a traumatised accident victim about what gear the driver was in just before hitting the tree.
 
0
Q: seems like a pretty simple line animation..but its not working and im going to kill everything

user1715717ooookay..this whole html5 cancas jive is waay new to me. so what im trying to do is have a 'pixel' moving across the sreen, with an additive tail behind it, to a certain point and then the have the pixel still 'moving' but have the contents of the tail scroll away. i really hope i described tha...

^ that title
@MartinJames what sense of melo-drama
 
@sehe been there
 
@sehe Shit! Murderous intent removed from title just as I was about to upvote for the title:(
Did anyone bother to actually look at the javascript?
 
12:42 AM
@MartinJames I removed crappy <pre>/</pre> tags from it. Does that count?
 
@sehe Yes, it certainly does!
 
@MartinJames Woot. I looked at it
 
I know it's JS therefore it's bad
So
 
Speaking of JavaScript, I am going to go fetch some water from the nearby fountain.
 
HTML5, javascript... just off to check my wine bag again.
Bad news/good news. I split the wine bag while trying to get it out of the cardboard case, but caught most of the wine in my glass.
 
12:54 AM
HAHAHAHA
I just wrote a C answer, with new char[21]
oops
 
@MartinJames Fun fact: "wine bag" collates after "wind bag", and the difference is a single bit (assuming ASCII encoding)
 
@sehe '(assuming ASCII encoding)' LOL!
 
@sehe LOL
 
@MartinJames Or compatible :)
 
@sehe Besides, my wine bag is now full of wind:( Too pissed to go the Tesco for more, so I'm stuck with 'windbag' handle for the night.
@MooingDuck You pointerised?
Also @MooingDuck, why are you here? Shouldn't you, like, be doing other stuff, on vacation somewhere with no net connection?
 
1:07 AM
Imagine I wanted to slit my wrists write a text file (blog post) on this thing. What crapp can I use for that?
@Martin other stuff, egg? So that is what people callI it these days...
Egg? Wtf.
I hate this thing.
 
@R.MartinhoFernandes So what exactly does a robot use to simulate drunkeness?
 
A touch screen
 
@R.MartinhoFernandes Dunno, doan' use no stinkin' tablets, 'cept maybe paracetamol tomorrow
 
Android;I cannot afford to pay for fruit logos
(I didn't pay for this thing, but whatever)
 
@R.MartinhoFernandes I hear a razor blade works well. Also, take a bunch of Aspirin first -- it helps keep your blood from coagulating.
 
1:11 AM
Helpful as always. Thank you.
 
@R.MartinhoFernandes I read that as 'fruit loops' fist time. maybe that's how you typed it?
 
I am probably going to use the razor blade for shaving though
 
@MartinJames crunch time at work and she has classes
 
@MooingDuck :((
 
Crunch time? Then what are you doing here? :-P
 
1:15 AM
@R.MartinhoFernandes He's probably used excuse #34 - 'I just put a build on, can't do much 'till it's finished'.
 
@R.MartinhoFernandes I've heard they work well for that too (though if you recall the picture Shog posted, you'll realize that my personal experience on the subject may be obsolete).
 
template metamagic is amazing.
So much code reduction.
So much magic.
It's like I'm in wonderland.
Or some trippy IDE-based equivalent.
 
@ThePhD Soon 'so much tragic'
 
@MartinJames I've just thoroughly tested the template metamagic with Vector2. It's doing what has been promised. I have no complaints yet.
 
If you are not feeling pain you haven't done enough template metamagic
 
1:17 AM
@ThePhD Have you delivered it yet?
 
@MartinJames ... Delivered?
 
@ThePhD LOL!
 
I feel like I've missed an important concept. =[
 
@ThePhD Yeah - best to not consider such matters..
 
There's a vim for android. I am scared now.
 
1:21 AM
@R.MartinhoFernandes also I only glance over every... half hour by the time
 
@R.MartinhoFernandes I don't even know what vim is. I'm assuming some sort of text editor. To me, it's a scouring powder used to clean toilets.
 
huh, I didn't think a simple loop would be that much faster than log+power: stackoverflow.com/questions/12700497/…
 
@R.MartinhoFernandes Oh shit! I googled it. It's vi!
 
vi sucks
@moo lol that macro answer
 
@R.MartinhoFernandes It surely did last time I used it on VAX, (which, funnily enough, is a make of vacuum cleaner here. Vim, VAX - it's all about dirt and crap).
 
1:27 AM
@R.MartinhoFernandes That's a special kind of silly
 
Sorry I have no idea what you are replying to :(
@martin vim is not vi
 
vim, not vi
 
@R.MartinhoFernandes I dunno - Google says it's a vi clone. Not used it so I don't know.
 
..... Wait
I've COMPLETELY shirked the original question I was trying to answer with all this union and metamagic stuff. What in the world?
 
@ThePhD There was an original question?
 
1:31 AM
@MartinJames well, in the sense that vi is a faint ancestor of Vim, yeah. But when people say 'it's vi', they usually mean 'original, standard UNIX, crippled vi', which is, shall we say, less useful
 
The answer was the original sin
 
Yeah. Seeing if I could somehow shoehorn D3DVector into my union for my Vector3/2/4 classes, and only for the <float> definition of it.
I think the goal was to shrink the code so I could instantiate a template-explicit class for it without having to break my fingers?
I think.
 
@sehe I've only used vi on DEC VAX. Yes, it was crap. Maybe look at this vim thing.
 
You'd be surprised. Start with a standard package version, and at least this for vimrc: syntax on|filetype indent on|filetype plugin on the rest is taste, but vanilla works fine most of the time
 
explicit operator D3DVector() const { return { v[0], v[1], v[2] }; } // done
 
1:36 AM
(Windows installer comes with crippled default vimrc, beware)
Wait 3:37am
Time to hit sacks
Bye all
 
@R.MartinhoFernandes @sehe is an hour later than here. Also, it's a bank-holiday in Germany today, Reunion Day, or something, - yippee! No emails/calls from Lord Haw-Haw!
 
1:57 AM
AWWWW
DIRTY
Unlike it's fellow D3DXMATRIX, D3DXVECTOR3 has nontrivial default constructors apparently.
And is so un-unionable.
Guess I'll just take the easy way out.
 
Xeo
2:54 AM
/me wants accumulate renamed to fold
 
"reduction" would be the better term in the parallel world
 
3:12 AM
What was that for, btw?
 
talking to me?
 
Xeo
Oh, some "reverse singly linked list" question.
Didn't put up an answer, though
@Mysticial aka reduce
 
Xeo
3:32 AM
@JerryCoffin Hopefully this is the case, and the C++11 standard is not responsible for his departure from this earthly realm. — paddy 51 secs ago
I know it's not right, but LOL
 
0
Q: How can I write the monadic bind operator (>>=) on paper?

missingno>>= takes a lot of dashes of the pencil to write down on paper and I always manage to make it look really ugly. Are there more convenient (and hopefully "standard") ways to write down this and other related monadic operators such as return and >=>?

 
Xeo
Wait, what is >=> in Haskell?
That looks like some sort of emoticon.
 
Can anyone help me regarding the command line batch file to find out the system is idle or not?
 
Xeo
Define "idle"
 
@Xeo the system is not in use for a while.
 
3:36 AM
@xeo it's Kleisli composition
 
Xeo
wat?
 
@avirk the system is always in use. That's not a good definition.
 
@R.MartinhoFernandes hmm you can say that but I mean that when user don't interact with it.
 
@xeo it's like normal function composition but for monadic functions hackage.haskell.org/packages/archive/base/latest/doc/html/src/…
 
Xeo
I see
 
3:40 AM
Any thoughts on this?
1
Q: Why empty base class optimization is not working?

MehrdadWhy is the empty base class optimization (EBO) not being fully applied in Visual C++? If I have a lot of base classes, is there any way for me to help the compiler make this optimization? #include <iostream> struct T1 { }; struct T2 { }; struct T3 { }; struct T4 { }; struct T5 { }; struc...

 
Xeo
Just read that, no thoughts yet except "wtf".
 
seems completely fucked up to me... and Mehrdad as well...
 
@avirk I don't think you can do that in batch files. Someone on stackoverflow might know better
 
Xeo
Even /Os (favor size) doesn't reduce it from 5... wtf.
 
@R.MartinhoFernandes actually I want to run a batch file and want to program it like if my system is idle for 20-30 min then it should be shutdown automatically :P
 
3:43 AM
Ebco cannot be done there
 
but if it comes out form the idle state then it should not be turned-off :D
 
Xeo
@R.MartinhoFernandes Why?
 
I would write an answer if I was not crippled by this
 
Xeo
I don't see why not, and GCC does it too.
 
@Xeo when u increase number of bases size goes up haphazardly
it may be that boost or gtk code shows some workaround, but i'm not going to dig
 
Xeo
3:45 AM
It also works if you simply chain the inheritence (aka T2 : T1, T3 : T2 ... Test : T6)
Okay, Test : T5, T6 and having T5 chain-inherit all the way up still prints 1
but Test : T4, T5, T6 and having T4 chain-inheriting makes it 2
 
Cannot put two bases at same address.
Aargh, expressing myself on this sucks
 
@R.MartinhoFernandes That obviously applies if they aren't empty.
 
@R.MartinhoFernandes that's what EBO is about
 
Xeo
@R.MartinhoFernandes Isn't the exact same thing happening in space-optimized tuple implementation?
 
Can't have two objects of the same type at the same address.
 
3:49 AM
Wait, I misread the question. Those are all unrelated types. Don't mind me.
 
I think Microsoft only applies the EBO to the first base class though.
 
I can't believe it's true everywhere from VC 2003 to VC 2012...
GCC seems to be getting it right
 
@BenVoigt not quite. it's a bit arbitrary
 
@BenVoigt It seemed weirder than that
 
Xeo
3:50 AM
3 mins ago, by Xeo
Okay, Test : T5, T6 and having T5 chain-inherit all the way up still prints 1
 
Guess it's just a crappy compiler
 
@Xeo Verrry interesting.... lemme try it
 
be interested to check whether struct Empty {}; struct NotEmpty { int i; }; struct A : Empty, NotEmpy {}; struct B : NotEmpty, Empty {}; have different sizes
 
Xeo
No shit, Sherlock. :s
#include <iostream>

struct T1 { };
struct T2 : T1{ };
struct T3 : T2{ };
struct T4 : T3{ };
struct T5 : T4{ };
struct T6 { };

struct Test : T5, T6 { };

int main() { std::cout << sizeof(Test); }   // Prints 1
woops
 
@Xeo oh thanks haha
 
3:51 AM
Xeo, that agrees with my suggested explanation
 
Xeo
@BenVoigt That's why the "woops", it should be "Prints 1" :P
 
@BenVoigt It seems to be doing that for T6 too though
 
T5 is empty and a left-most base class, hence optimized out. T6 is not left-most, hence it is turned into a subobject with the smallest possible size (1).
 
Xeo
@BenVoigt It's not.
 
@BenVoigt Yeah you seem to be explaining it correctly...
 
Xeo
3:54 AM
@Mehrdad If that was the case, my test above would print 2, not 1.
 
@Xeo Why?
 
Xeo
empty base + base subobject of size 1 + derived object with size 1
 
Msvc sucks, have I mentioned that?
 
Xeo
The most-derived type always has atleast size 1
 
But that's inclusive of all subobjects.
 
3:55 AM
@Xeo Ah I think we might be reading Ben's comment differently
 
Xeo
Aahhh, true.
Damn
Obviously, if it gets a size from one of the bases, it doesn't need an extra size of its own anymore. My bad.
 
Only performing the optimization on the left-most base is a simple way to avoid corner cases.
 
@Xeo Yeah it seems to be what's happening. Funny behavior..
 
Corner cases like: template<typename T> struct Derived : T, Empty {}; sizeof(Derived<Empty>)
 
@BenVoigt Isn't that just an error anyway?
 
Xeo
3:57 AM
Aye.
 
Sorry. But there's a related corner case there somewhere.
 
Xeo
@R.MartinhoFernandes Page not found.
 
@R.MartinhoFernandes The content that you requested cannot be found or you do not have permission to view it.
 
lol
 
3:59 AM
template<typename Base> struct OneBase : Base{}; template<typename T> struct Derived : OneBase<T>, Empty {}; sizeof(Derived<Empty>)
 

« first day (718 days earlier)      last day (4239 days later) »