« first day (238 days earlier)      last day (4708 days later) » 
00:00 - 16:0016:00 - 00:00

4:14 PM
__FORCETOC__ In computer science, type punning is a common term for any programming technique that subverts or circumvents the type system of a programming language in order to achieve an effect that would be difficult or impossible to achieve within the bounds of the formal language. In C and C++, constructs such as type conversion, union, and reinterpret_cast are provided in order to permit many kinds of type punning, although some kinds are not actually supported by the standard language. For example, reading from a different union member than the last one written invokes unspecified be...
Hehe.
> For example, reading from a different union member than the last one written invokes unspecified behavior
So, we can't use unions to interpret the same bit sequence as different types?
 
not Standard-ly, no
but many implementations guarantee that you can
 
0
Q: How to design function interfaces that can deal with varied number of arguments or having any combination of argument types?

StackedCrookedOccasionaly I find that I need a generic "pass through"-interface. For example for mix-in classes that forward their constructor arguments to the parent. Or for factory methods that forward their arguments to new: template<typename C> C * Create(); template<typename C, typename Arg0&g...

Any takers? :D
 
I already answered it
 
and, if I want to check out questions, I will check the question list, thanks, and do not appreciate them being re-posted here
nobody else seems to care though, that's just me
 
4:22 PM
@DeadMG well, it is a feature.
 
the ability to link to questions != posting questions in here to get answers
 
You can use that feature when you want to discuss a question.
 
linking questions is for discussing questions
 
To show what the object of discussion is.
 
Asking for attention is not necessarily a bad thing. It enhances socialness.
 
4:23 PM
it is a bad thing
if I wanted to give your question attention, then I would do so
as, in fact, I did
if I want to look at questions, then I will check the questions list, else, I do not want to look at questions, and it's pretty safe to say that whilst I'm paying attention in here, I am not currently checking the questions list
 
It's kind of depressing that C++11 is very far away for those in the industry.
@DeadMG you could simply ignore it if it doesn't interest you.
 
yeah, but I can't get my screen space back
 
Lemme post an amazon book link and you'll see where your screen space goes!
 
I think not
 
Don't worry, I won't. Those are annoyingly huge.
Is there a variable-size bitfield type in the stdlib?
 
4:30 PM
@DeadMG You make me remember the late nineties when clicking the wrong link could result in a explosion popups that reproduced faster than you could close them.
How did you ever survive that period :D
 
4:59 PM
OMG, I just started reading about perfect forwarding and I am finding myself to be abnormally excited.
 
@Martinho: std::bitset
oh wait, isn't that static? There's a boost::dynamic_bitset, iirc, or you could just use vector<bool>
 
5:16 PM
you know
I'm a moron
3
for positive subset sum, then the number of valid combinations that could sum to W, is the partitions of W, excepting those which have duplicate entries
 
5:35 PM
I have a brilliant idea for a game.
Frog apocalypse. It's like a zombie apocalypse, only with frogs.
 
lol
you know, Wiki says that something polynomial in W is actually specified as exponential in P, the number of bits used to specify W
what, so it's not good enough to solve in linear time to the input, it'd have to be logarithmic?
:(
 
6:12 PM
hello, is there anybody out there?
 
no
 
hehe
can i just briefly ask a technical but dumb question
 
We're all just figments of your imagination.
I've never understood the tendency to ask 'Can I ask question?' questions.
 
i`m new to c++ and i was wondering if i have a MFC appliation with a .h and a .cpp file, how would i compile and run it in visual studio 2008? any help?
 
Of course you can, the worst thing that can happen is that nobody will know the answer.
Well, or ignore you completely, but that is more likely to happen after that opening line.
 
6:15 PM
or any other simpler way of doing it without VS08?
 
Create a solution, create a project, add files, press F7 or F5.
Or Build > Build solution.
IIRC.
 
ok thanks ` let me try now
nice cat by the way
 
puppy > cat
 
Hi
 
Ih.
> The server at stackoverflow.com is taking too long to respond.
OH NO.
 
6:26 PM
I once seen a thread here discussing about the new standard of c++ shipped. Could some one please refer me to that link
 
It hasn't been released as a final standard yet, if that's what you're looking for.
 
ok call me dumb but i am still lost, here is my question in short, i have access to a .h and a .cpp file that are part of an MFC application, how on earth do I compile and run them in Visual Studio2008? :S
 
Have you created a solution with a project?
 
how do i do that?
i think i have
 
Easiest way will be to create a new MFC application, remove generated files and add your own, if yours are a complete app. Then the settings should be just fine.
 
6:28 PM
thanks
 
@CatPlusPlus - Thanks for the info.
 
i was trying to modify those files rather than add my own
running into errors left right center
 
There will probably be a precompiled header set up, so you might want to turn that off in the project settings.
 
there are 7 different header files under the Headers folder in my solution explorer, shall i delete all of those?
 
Quick question dudes : difference between char** and char *array[]
 
6:32 PM
First is a pointer to pointer to char, second is an array of pointers to char.
 
How come I can use the second as a 2D array then?
nevermind that was a dumb question
 
Because of the array-pointer shenanigans. Why are you using char pointers and arrays in the first place?
 
ok Cat++ I`m still have trouble, here is my question in short
softcircuits.com/Blog/post/2010/01/21/… <<<<How can i compile and run that application in VS08?
 
I'm taking a string and parsing it into arguments
 
@Neville It's not a complete application, it's just one class to do a specific thing.
@TrevorArjeski std::string, std::vector.
 
6:37 PM
so i can not run it?
 
@Neville Just this? No, it's not runnable, you need to write client code that would use it.
 
i have been told to make a .csv viewer using MFC, so that when u drag and drop .csv files it displays the files as excel style tables, any idea how i woud go about doing that?
 
I don't use MFC.
 
why are people still using this damn old technology?
 
is std::string the same as C's string library
 
6:41 PM
No.
C string library is an abysmal piece of crap, to put it mildly.
 
hahaha
i guess i should have mentioned that i'm using C
 
Well, my condolences.
 
:[
I just wasnt sure how I could return the array of pointers
in a function
actually, i'll just have to work with pointers then after i'm done never use C again
 
you cannot return an array of pointers
i.e T * f()[N]; is invalid
 
right
 
6:53 PM
the SO team could create a bot that compiles code for the channels. i mean, an official "compile bot"
so ppl can directly insert code in their channels and let it compile and run (of course, with limited resource power etc)
 
that would be interesting
 
something like ideone integrated into the chats. they could run the compiler on the clientside with javascript. it doesn't have to run on their server
seeing how javascript engines can run entire linux machines, i'm confident it's entirely reasonable.
 
We could try to adapt geordi.
 
but it would only make loungec a better place. not all the other channels :(
 
I wouldn't want someone's code being compiled in my browser, though.
 
6:58 PM
no. that guy compiles the code, and sends the output to the channel
there could be a button "verify" that you could press to see whether his code really prints what his message says it does
 
Ideone has an API, so it doesn't really have to involve porting a compiler into JS VM.
 
now, just take clang and compile it to LLVM and use emscripten to get a javascript c++ compiler xD
 
user379888
Can anyone help me giving input to it. I have never given input to main(). Please help me out.
https://ideone.com/KPrtU
 
user379888
How do I give it input?
 
user379888
I mean should I give two inputs or just one?
 
user379888
7:10 PM
:'(
 
It wants the URL as an argument, not through standard input.
 
user379888
I am giving it a url but in the main() function I found that argc should not be 1 . How do I send multiple inputs?
 
argc is 1 when there are no arguments. argv[0] is always present, and it's a program name.
 
user379888
So I can not run it on ideone?
 
Not in that form. ideone.com/yzhJ9
 
user379888
7:21 PM
Thanks :)
 
7:32 PM
WTF's a *.inl file?
 
You know, when you stare into Boost, Boost stares into you.
.inl is usually inline code.
 
@DeadMG Yep, it's static. The size is given as a template parameter. Pity vector<bool> or boost::dynamic_bitset won't allow me to do what I want :( I'll need to send the bits down the network.
 
(Eh, Boost uses .ipp, I think. I'm stupid.)
 
8:03 PM
there was a stackexchange to talk about code rigth anyone recall the url ? I mean I have an idea about flood control and would like to discuss how efficient it would be or things like that to see if my approach is even usable ?
 
8:18 PM
Good afternoon, all. If I have a 16-bit integer, and I just want to write an 8-bit value to the lower 8 bits of the 16-bit integer, is there a bitwise operation I can do to accomplish this?
 
(X & ~(X & 0xFF)) | Y.
X | Y, if you don't need to clear them first.
 
Some people can't handle criticism. lol
Someone just downvoted two of my answers because I downvoted his totally irrelevant answer.
Oh well.
 
8:48 PM
Does anyone thank that the way .reset() is implemented in the smart pointers leads to wrong order of construction/destruction?
boost::scoped_ptr<Component> component;
component.reset(new NotiferComponent);
    // 1. Creation of 2nd Notifer object
    // 2. Deletion of 1st Notifer object
Which can sometimes lead to bugs. (Actually got burned once.)
 
You can do:
component.reset();
component.reset(new NotifierComponent);
 
Thank you, Cat Plus Plus!
 
Bit uglier, but does what you expect.
 
@MartinhoFernandes Yes, but that seems like a workaround, implicitly agreeing with the current wrongness :)
 
I don't think there's another way of doing it, because it's not the smart pointer that constructs the new object, it's you.
 
8:51 PM
@MartinhoFernandes I think the smart pointer constructing the object would be the right solution.
 
That would solve your problem, but would be less flexible.
Hmm, or not.
 
I don't find it less flexible. You could provide the smart pointer with a factory functor. Or have a create method that supports argument forwarding ..
Well, just my thoughts..
 
@StackedCrooked Yes, I thought about that. That's what lead me to say "or not"
But you need to change the semantics a bit.
 
@MartinhoFernandes true
 
Because, if the constructor throws, the old object is gone and the pointer is now useless.
 
8:56 PM
@MartinhoFernandes yeah, if the constructor fails, then you need to fix the problem either way,
The boost people are very smart. Why didn't they do it like this :)
 
Current smart pointer semantics leave the pointer in it's prior state.
Your proposed semantics destroy the prior state.
It's the strong exception guarantee, I think.
 
Hm. I don't see it as a big deal. The big deal is the failing constructor IMO.
Which is a situation the user must handle. But perhaps that was a reasoning.
 
I think either option is ok, as long as it's documented.
 
Aren't arguments evaluated first?
 
If you are rock climbing and you need to change your ropes. You would first attach the new one, and the detach the old one. Perhaps that's the reasoning. I dunno.
 
9:01 PM
@KhaledNassar Yep. That's exactly the point @StackedCrooked was raising.
@StackedCrooked Exactly. You're never left without a rope, even if you let the new one fall.
 
Then the allocation & construction of the object passed to the smart pointer should be passed to the reset function accordingly.
new object is constructed -> passed to reset() -> smart pointer does its job of taking care of the old object.
 
But the point was that you didn't want to construct a new object before getting rid of the old one.
 
But inconsistent order of construction/destruction can lead to even subtler bugs I think.
 
@MartinhoFernandes Ah, I didn't pick that piece up.
 
@StackedCrooked Where's the inconsistency? All smart pointers work like this.
Ow, Neil went over the top again:
-6
Q: Deprecation considered silly

Neil ButterworthI've just been compiling some of my own code with the -std=c++0x flag in GCC, as I want to vaguely keep up with what all the young folks are doing (provided they stay of my lawn), and I ended up with a load of warnings about auto_ptr being deprecated. Of course, I knew that auto_ptr was deprecate...

 
9:12 PM
My post was similar, but formulated in a more positive way and I got upvotes :)
7
Q: Should I stop using auto_ptr?

StackedCrookedI've recently started appreciating std::auto_ptr and now I read that it will be deprecated. I started using it for two situations: Return value of a factory Communicating ownership transfer Examples: // Exception safe and makes it clear that the caller has ownership. std::auto_ptr<Compon...

@MartinhoFernandes they are consistent with each other. But I think in the 90s people reset the pointers as follows: delete p; p = new Foo();. So the smart ptrs are not consistent with that.
 
True that.
 
@MartinhoFernandes I'm not used to people agreeing so quickly. It feels odd.
 
Well, I tend to agree with what I can't refute.
> AFAIK, unique_ptr is not a direct replacement. The major flaw that it fixes is the implicit transfer of ownership.
Wow, the major flaw is the fix.
 
Lala
It's slightly less vicious.
If you class has a member that is an auto_ptr then you better make sure that class is non-copyable.
unique_ptr is non-copyable, so that problem won't occur
 
9:28 PM
The best thing about unique_ptr is that the compiler will refuse to generate the copy ctor in that situation.
 
Move semantics are becoming more and more meaningful to me.
 
Yes, it's great. I can't see how you guys could work at all without it all these years.
 
When I first heard about it it didn't make any sense to me at all.
 
To me, it has been an integral part of my C++ education, so I can't say I'm experienced in not using it.
Man, that sentence was weird.
 
Ah, I only recently been delving in the the newer stuff.
I am not capable to judge due to sleep deprivation.
Saturday night doesn't seem like a busy night on SO.
What the hell is everybody doing then?
:D
 
9:35 PM
I don't, it's Saturday night. People supposedly go out and stuff like that.
Social- something or other.
 
pfft
losers!
they should get an e-Life
 
@DeadMG I have a surprise for you
0
Q: The .reset() method of common smart pointers

StackedCrookedIt seems to me that the reset method in the boost scoped_ptr and shared_ptr lead to incorrect order of construction and destruction: boost::scoped_ptr<Component> component(GetDefaultComponent()); component.reset(new BetterComponent); // 1. Creation of the new object ...

 
I'm gonna ignore you if you keep doing that
 
It was mostly a matter of lucky timing that caused this.
You showed up just when I was about to post a link. I'm sorry, I couldn't resist.
 
im creating a programming language
I have it implemented and its compiler already built
the language is a new lisp dialect.
its called MLI
 
9:57 PM
you know
 
@cyberrog Creating an programming language and writing a compiler is, according to what I read in a Steve Yegge post once, a very impressive feat.
@cyberrog Eh, that's how far my knowledge reaches. Sorry:(
 
10:10 PM
I was going to make a language one day
but, well, I've got more than enough knocking around in my massive head
man
I need more accepted answers
already well over the rep-cap for the day
 
10:27 PM
@StackedCrooked TBH a LISP dialect is not too complicated.
 
@MartinhoFernandes You really just need to rename the core functions. :P
 
Evening all.
what's new?
 
@MartinhoFernandes Ok.
@TonyTheTiger We've are almost at 1 year without goverment :D
 
Just making a language is not that hard. Designing a good, sane language is a bit tricky, there's a lot of things to think about. Writing a compiler can be hard, depending on how the language turns out.
I'd say making another LISP dialect isn't fun at all.
 
@StackedCrooked I know, that's pretty insane imho
 
10:32 PM
Can you believe I have actually written a C++ parser. Granted, it didn't work in the least. But still.
 
@StackedCrooked You guys going for the world record?
 
@StackedCrooked hahah
 
@CatPlusPlus Who's holding the current one?
 
@CatPlusPlus yea I think that's what they want, no one else should do it as long as we are
@MartinhoFernandes we are holding it
 
@CatPlusPlus We already beat that and had a big party. However, we were embarrased to find out a few weeks later that we didn't really beat it.
 
10:33 PM
@MartinhoFernandes I don't know really. I can name just a few countries. :P
I mean, in general.
 
But it's possible that by now, we did really beat it.
 
Governments are overrated, anyway.
 
yes, they are definitely overrated
 
@CatPlusPlus People can exist without government. Governments cannot exist without the people.
 
and why do we have all these people working for politicians... it's just crazy
 
10:35 PM
All they do is sit there and tell you to give them money, because you happen to be in a proximity defined by arbitrary lines on a map.
 
@CatPlusPlus Ok. In all fairness, I think some of them may disagree with that statement.
 
I will never understand this world.
 
they're a waste of money and time, they are only there to fill their own pockets with money
the Belgain govt just proved that
what have they accomplished the last year
fuck all if you ask me
 
@CatPlusPlus you only need to understand that every person is essentially selfishly oriented. Everything makes sense from that point on.
@CatPlusPlus except for Ghandi. He was a good man.
 
@StackedCrooked I think that's only the case when money is involved
 
10:37 PM
@StackedCrooked Oh I know that. Yet it doesn't explain why almost everyone acts so stupid.
 
but that's my opinion
 
Eh, I'm going to be rambling incoherently again if we go there.
So let's talk about something fun.
 
@CatPlusPlus, you do have a point there. I think that explanation for that is neurovariance.
 
oh no, that's off limits here... sorry forgot :(
 
10:38 PM
@StackedCrooked Is that a fancy way of saying "insane"?
 
Is that even a word?
 
@MartinhoFernandes Basically yes. It is saying that nature always produces a "variety" (euphemism) of personalities in order to keep natural selection going.
 
ugh, my internet connection here sucks :(
now I don't see any avatars
 
@TonyTheTiger Where is that?
 
10:41 PM
@StackedCrooked some place... don't wanna say that on here
 
You clearly need a 500$ Ethernet cable.
 
Haha, I bet you went to a very embarrasing place :p
Like, holland
Never mind :)
 
No good WiFi in those damn strip clubs, eh?
3
 
hahah I wish
 
10:43 PM
@CatPlusPlus I know. It's a damn shame.
 
lol
ugh, even reddit being retarded
 
No, that's normal.
 
what? that I can't get to reddit?
 
That too.
 
damn :(
 
10:45 PM
Although it does appear to be working ATM. Maybe they finally exchanged their souls for new servers.
 
are you a frequent browser of reddit?
 
My browser is frequently reddit.
 
man
one of these days, I want to go back and finish my language
 
What did it look like?
 
10:50 PM
well, it was kind of similar to C++, if it had actually been designed to be that way instead of having to keep all the C crap
no headers, much stronger constexpr, and I had a bunch of other things I wanted to add, from memory
 
I'd love the "no headers" part.
I hate the preprocessor.
 
but it's been a long time since I thought about it and I've forgotten a lot :(
oh
 
I'll remember this day. "It was like a million language lawyers crying out in unison, then suddenly silenced."
 
I also wanted to cut a lot (almost all) of C functions
 
@CatPlusPlus Yeah, seems like Oracle pulled the Java spec out of the interwebs.
 
10:52 PM
and I wanted to add opt-in run-time reflection and static reflection
I also wanted to cut ADL and add kinda-similar extension methods
 
@DeadMG Like C#?
 
I'm not too familiar with how their extension methods work
 
Hmm, if I answer thirteen more questions, I'll have a bronze badge. No upvotes required. If I was obsessed with badges, I'd now be busy spamming useless answers.
 
but basically, I decided that the current system is stupid
after all, isn't whether or not a function needs access to my internal details an implementation decision?
I should be able to pick member or non-member as a syntactic choice, not a semantic one
and I also definitely didn't like how you can't turn off ADL
and I wanted to look at adding (not exclusively) garbage collection
although recently, I've come to believe that you don't need it if you add in some custom allocators
 
Sounds like a lot of complicated stuff, on top of already complicated C++.
 
10:57 PM
except I'm cutting a lot of stuff
almost all the C-legacy stuff, especially
no implicit pointer conversions, at all, no headers, etc
and changing the syntax to be context-free
 
So why basing on C++ at all?
 
and a lot of stuff that's complex now, like TMP, can be accomplished much easier with "DeadMG constexpr"
well, because I think the result should offer roughly the same philosophies
customization, performance, value-typed
oh, and I also cut things like value initialization- that's just stupid
I actually got somewhere, but stopped when I realized that I had no way to implement a compiler without some bitchin' new knowledge of assembler
I also wanted to add concepts, but I figured that they would be redundant after the new powers I offered through static reflection
I also wanted to make new and delete Standard library functions instead of language constructs
 
I should find some time and finally learn Haskell properly.
 
oh, I wanted to add a much slicker method to version the Standard library
kinda like cutting the Standard library, and making Boost official, almost
 
@CatPlusPlus Me too, also assembly, and Clojure.
 
11:07 PM
There's not much to learn about assembly IMO.
It's low-level and ultimately, boring and tedious.
 
@CatPlusPlus Write something entirely pointfree (without variables). Then write something with monads.
If you managed to do that, you're good.
 
I can do pointfree, most of the time. Monads, not so good.
I think I understand them a little better after that video posted here some time ago.
 
The one with Brian, the hat guy from physics?
 
Yeah.
Would be nice to finally be able to read my old copy-paste-created Parsec code.
 
Well, once upon a time, I thought I understood monads. And then BAM! Monad transformers hit me.
 
11:17 PM
I thought they were people with camels.
ThiefMaster is here again. Watch out for your possessions..
After reading a little on BOOST_FOREACH I've been struggling to create something like this:
std::pair<A, B> thePair;
THE_MAGIC_FOO(thePair, a, b)
    // macro that defines declares "A & a = thePair.first;" and "B & b= thePair.second;"
{
 // a and b are accessible here
}
But it seems there is no way to make this work in C++03.
 
11:34 PM
you can really "turn off" ADL by saying (f)(args ...)
 
Nice.
I want to use it, but I've never have been troubled by unwanted ADL. :D
I'm not advanced enough for that.
 
sure, I could do, but then I'd have to enclose every function call in brackets
 
Btw, ThiefMaster is gone now.
Btw, I recently heard that the latest C++ standard was in 98. What was 03 then exactly?
Btw, in highschool we once had a Chinese exchange student. The teacher told us to not speak with him so that he would eventually go away. And so it happened.
 
The latest C++ Standard is C++03
however, it didn't really do much except fix bugs in the 98 Standard
 
But C++03 was is an official standard.
 
11:44 PM
it is the Standard
if anyone tells you that it is not Standard, then it is most assuredly Standard
and they are wrong
 
@StackedCrooked there is some confusion as to what c++03 really is. It originally was intended to be a TC (technical corrigendum, so that officially, it would still be a 98' Standard). But due to some formalities, it ended up as a new Standard release
 
Ok. I just like to get my facts straight so I won't be embarrassed on the next cocktail party.
2
@JohannesSchaublitb Interesting.
 
so many sources will say it's TC1, but from what I know it's not a TC
 
I think that it's odd that the word "dense" means much content in small form. While for girls it means the opposite.
I discovered this when I heard a girl say "Lol I'm so dense". I thought: isn't that a good thing?
I'm glad I got that cleared up eventually.
 
depends in what exact area she finds herself dense
 
11:55 PM
She probably just said it to appear cute.
 
in my experience, cuteness is actually pretty rare in girls
 
@DeadMG you mean, you see it more in boys?
 
no? why would you think that
 
Well, there's boys and there's girls. One or the other. What other option did I have?
 
the number of girls and the number of boys that are cute in my opinion are completely orthogonal
 
00:00 - 16:0016:00 - 00:00

« first day (238 days earlier)      last day (4708 days later) »