« first day (560 days earlier)      last day (4389 days later) » 

4:01 PM
When I see XCode I always think it's some porn related thing :P
 
@TonyTheLion ... great, from now henceforth, ill think that too ... my whole life is a lie ...
 
lol
Hmmm this is interesting
 
I have +- 100 abilities that inherit from "Ability", whats the best way to organize them in my project so they are somehow grouped ?
 
Inheritance went out of favor 10 years ago, haven't you heard? ;)
Anyway, you can group them in namespaces, for example.
 
Yeah that should work, thanks.
I prefer composition to inheritance but it's fairly convenient in my case.
 
4:10 PM
What virtual functions does "Ability" have?
 
Couple, use(), wait(), revert(). (game mechanics related)
Why ?
Dere any better design decision to be made :) ?
 
I use inheritance on a regular basis. Doesn't mean that polymorphic types are involved every time.
Perhaps this is good time to (re)use the term 'subclassing'? Not really sure.
 
Mhm, i haven't thought of this all that much, it seemed like a natural thing to do ... the "is-a cliche" applies here fairly well.
 
I mean things like class iterator: boost::iterator_facade</* ... */> .... This is not about is-a vs has-a vs is-implemented-in-terms-of.
 
@FredOverflow How would you go about creating many abilities with different effects ? (There are certain attributes that the abilities share, like, most of them deal damage, but there are also many unique traits.)
 
4:18 PM
@ScarletAmaranth I wouldn't know, never programmed such a game before :)
 
@LucDanton I find that when coding low-level components non-polymorphic inheritance is quite convenient, whereas for high-level class hierarchies composition is often more appropriate.
 
@FredOverflow Never have i :-/ Oh well, the best way to learn it is to do it :)
 
@ScarletAmaranth You can pass a reference to the thing that the ability is being used on to an apply function on the ability
 
user784668
@ScarletAmaranth vector<Effect>?
 
which is virtual
if you need to call a parent (common damage function or something) call up the chain.. Ability::apply(entityRef)
 
4:20 PM
@ScarletAmaranth I would probably go for a system where certain functionality can be inserted at runtime. Decorator and visitor come to mind.
 
@StackedCrooked You can't compose a boost::iterator_facade though.
 
Interesting, so having a class Ability with a certain "void applyShit() " and then passing in what effects to apply is a better idea ?
 
Hmm :/
 
user784668
@ScarletAmaranth certainly better than having a gazillion and two oranges of classes that inherit from Ability.
 
@ScarletAmaranth Some way to iterate over the current abilities and activate, use or unload them.
 
4:22 PM
@Fanael It's not all that big of a hassle really.
 
Have I walked into a 'prefer composition to inheritance' argument?
 
@FredOverflow I tried my best … but now we’re settled with a fascist C++ …
 
There is no argument about it :) Composition is preferred to inheritance ^^
 
user784668
@TomW Yes.
 
just tried to make a C++ logo. Turned out to be very horrible.
 
4:23 PM
Decorator is useful if you want to enhance abilities. For example a potion that gives you a 20% speed boost is something that can be non-intrusively added using decorator pattern.
 
@KonradRudolph doesn't look very modern, but still nice :)
 
@StackedCrooked That's a great idea, thanks.
 
You can't prefer composition over inheritance when dealing with e.g. static polymorphism :| That was my whole point.
 
4:24 PM
@IntermediateHacker Ok now that's bad :)
 
lol
 
@LucDanton You don't say! :D
 
@FredOverflow Well, it woulda been modern in 30’s Germany
 
@KonradRudolph Maybe it'll be modern again in 18 years then? ;)
 
4:25 PM
o_O
 
That is a concerning statement that I'm not sure I want to think about anymore, Fred
 
that's a pacman and a tic-tac-toe board
 
C# == C++++. D:
 
cpx
4:25 PM
C++++
 
user784668
C--
 
C++++ is C += 2 ... not too bad i guess :)
 
cpx
++ == + in C++
 
user784668
We need C&& !
 
4:26 PM
@TonyTheLion I like the idea
 
@Fanael that's how C++11 must have been called.
C&&: Move away from C!
 
C *= interest-rate -> nice accumulation
 
user784668
@classdaknok_t lol, yeah
 
Cλλ is also appropriate.
 
@IntermediateHacker o_O
 
Dat font.
 
user784668
@classdaknok_t Or C......
 
@ScarletAmaranth No, C++++ does not compile, at least not for built-in types, because C++ is an rvalue, but the second ++ needs an lvalue.
 
wait, I've got it!
 
4:30 PM
@FredOverflow REFERENCE ALL THE RVALUES!
 
user784668
@FredOverflow Who said that decltype(C) yields a built-in?
 
@FredOverflow Define ALL the behavior! :)
 
@ScarletAmaranth Not even Java defines all behavior.
 
It doesn't?
 
data races
 
4:31 PM
:(
 
@Pubby no that's good, otherwise C++ would have a con Java doesn't have.
 
@Fanael No sane C++ programmer would define postfix ++ as a member function.
 
@FredOverflow Why not postfix as member?
 
C11 did take over many things from C++.
 
4:32 PM
@classdaknok_t which clearly is impossible
 
data race = the race "Data" (the Android from Star Trek TNG) belongs to? :)
There is at least one other such Android, right?
 
Yah, Ganondorf.
 
Google slaps me with this and this
 
@Pubby You normally implement prefix ++ as a member function and postfix ++as non-member function (in terms of prefix ++). That's just the way we roll.
 
user784668
@FredOverflow Not all programmers are sane.
 
4:35 PM
@Fanael true :(
 
user784668
We need IOC++CC.
 
@Fanael that's called Objective-C++.
 
user784668
@classdaknok_t Not obfuscated enough.
 
What does IOC stand for?
 
IOPerlCC would make no sense.
IOCCC = International Obfuscated C Code Contest.
 
user784668
4:37 PM
@FredOverflow "International Obfuscated C". So IOC++CC would be "International Obfuscated C++ Code Contest"
 
Kevlin Henney once said that there will never be an obfuscated C++ contest because "there's no challenge" :)
6
 
what does "^^" mean?
 
it's a face :)
 
4:39 PM
^^ = ^_^
 
Oh hey, Progress Quest is open source.
 
oh, pardon me for my unimaginativeness.
 
user784668
@IntermediateHacker Exponentiation.
 
@CatPlusPlus I didn't expect that.
 
user784668
@IntermediateHacker (^^) :: (Fractional a, Integral b) => a -> b -> a
 
4:39 PM
That's two xors :)
 
Logical XOR.
 
And there's web version. Which is also open.
 
constexpr int O_o(int x, int y, int z) { return x ^ y ^ z; }
 
This calls for a Haskell version.
 
@FredOverflow make it constexpr and I'm happy.
 
4:41 PM
HASKELL! RUN!
 
Where exactly does constexpr go?
 
Before the return type.
 
To a bar.
 
user784668
echo "constexpr" > /dev/null
 
SOMEBODY is obsessed with Haskell...
2
 
4:42 PM
@CatPlusPlus constexpr can only go to a compile-time bar, though...
 

So two Stack Overflow users walk into a bar...

Mar 6 '11 at 15:24, 29 seconds total – 4 messages, 1 user, 12 stars

Bookmarked Mar 6 '11 at 15:41 by Yi Jiang's Proble_

 
It's better than compile-time hell.
 
my main problem with Haskell is that because I'm a nerd, I mumble, and people therefore can't therefore tell the difference between that and Pascal
 
user784668
@TomW I want to meet SOMEBODY, then.
 
4:43 PM
Is that Haskell Curry?
 
Yup, got (a picture of) him hanging on my wall. (just kidding!)
 
@FredOverflow constexpr functions can be executed at runtime.
 
@classdaknok_t oh yeah
 
 
Alonzo church sounds like a religion.
 
4:44 PM
@classdaknok_t ROFL
 
any novel witticisms one can make about Haskell, almost definitely don't apply to its homonym, Pascal - so everyone thinks you're a tard
 
Why is everyone sharing black and white pictures of people I don't know?
 
Those are pictures of God.
 
@IntermediateHacker Have you ever heard of lambda calculus? Even 1 + 2 is insanely complicated in lambda calculus, and the second guy invented it :)
lambda calculus has no "integer literals", right?
 
4:46 PM
 
@Pubby who's that idiot?
 
@IntermediateHacker probably someone who calls himself an idiot. Yeah, it's idiotic.
 
@CatPlusPlus So, you choose your class and you ... wait for the game to play itself :) ?
 
@IntermediateHacker one more:
 
4:47 PM
Like a MMO.
 
@FredOverflow I never really understood what lambda calculus WAS
I've read the explanation
 
@TomW You just need to understand that it's awesome ;)
 
It's math.
 
but I just thought "Does this concept actually deserve a name?"
 
4:48 PM
It's got something to do with lambdas.
 
How'd you refer to it if it didn't have a name?
 
A calculus is nothing more than a system with certain rules in which you can calculate stuff :)
 
"That thing with anonymous functions" is a name, too.
 
(I'm a physicist - I tend to see computability problems as an implementation detail)
 
Is lambda calculus basically just passing functions as parameters?
 
4:50 PM
Happy wife, Happy life !!!
 
@classdaknok_t No.
 
@classdaknok_t that's one of its practical applications
 
@CatPlusPlus Is it possible to die in ProgressQuest ?
 
Do you really have to ask?
 
I'm just wondering :) But yes/no would be actually a shorter thing to type than "Do you really have to ask?" ;)
 
4:52 PM
Meh maybe I'll learn what it is in a few years.
 
@ScarletAmaranth Apparently the question bothered him greatly.
 
A few years? It takes like an hour or two to understand it at a practical level.
 
@StackedCrooked Yeah, Cats are known to have weird personalities :)
 
@Pubby Yeah, if I put effort into it. :P
 
Also, is there any difference between s and cl in Vim?
 
4:54 PM
@ScarletAmaranth You better apologize sincerely.
 
@ScarletAmaranth I agree. They eat chicken, for example. 3:
 
s is character-wise, it doesn't take text object.
 
@xeo Am I being dumb or is that just an old compiler that doesn't know that syntax
 
@SethCarnegie both.
 
@CatPlusPlus But doesn't cl do a character too?
 
4:57 PM
Imma play Minecraft so see ya
 
Does anyone here know why this isn't compiling
Is it wrong or is the compiler too old
 
@Pubby If you really want to waste keystrokes. :P
c is just more general.
 
@SethCarnegie If initialising an std::array doesn't work, add more braces.
I.e. go with {{ 1, 2, 3, 4, 5 }}
 
I'd rather bind s to something more useful and save keystrokes in the long run!
 
The advice holds for objects that themselves hold std::arrays.
 
4:59 PM
@LucDanton nope, doesn't work still
same error
 
Bad compiler then.
 
What about parens ({}) ?
 
@Pubby nope
 
(Also, that looks dirty :S)
 
@LucDanton ok thanks
 
Xeo
5:00 PM
@Pubby No, that would create an initializer list
 
Parens + double braces?
 
{({})}
 
Xeo
@Luct, can't you try with GCC 4.7?
 
LISP reinvented.
 
@Xeo I know double braces are supposed to work, but sure.
 
5:00 PM
@CatPlusPlus no, lisp doesn't use { }
 
No kidding.
(Also, not by default, but that doesn't mean it can't.)
 
Xeo
I think it's just GCC 4.5.1 that doesn't support that initialization form yet.
 
Yeah I know
 
yep, double braces work.
 
@LucDanton ok thanks then, old compiler.
 
Xeo
5:01 PM
@LucDanton And single?
 
@Xeo What is rules with initilizer lists?
 
@Pubby no one knows
 
> error: array must be initialized with a brace-enclosed initializer
 
Xeo
Ah, so brace elision doesn't work there.
 
Oh, hey, I have GHC 7.4 here.
 
5:03 PM
So do I apparently. Is this good?
 
Does it support inheriting constructors?
 
Xeo
@Seth, why didn't you change the answer instead? The initializer_list roundabout way is not the best that can be
 
Type definitions in GHCi!
 
@Xeo because it's your answer, not mine
 
Blah, Gimp is such a pain to use. Is there a decent MS Paint for Linux?
 
Xeo
5:05 PM
@SethCarnegie I hereby grant you the right to use your new knowledge to improve your answer :P
 
@Xeo also what is the picture in your avatar? It looks cool
 
Xeo
If I wanted to post an answer, I'd have done so. All you were missing was to remove the extraneous parens
@SethCarnegie Accelerator from the Toaru Majutsu no Index Universe. :)
 
Wtf, something grabbed the lock for dpkg et al. but didn't release.
 
@Xeo will read :)
 
Xeo
@SethCarnegie Please read the Light Novel and don't watch the Anime! :)
The adaption is fairly bad
 
5:08 PM
@Xeo is the manga also bad? I usually read those instead of watching anime
 
Xeo
The manga is so slow in being released. :/
 
@Xeo oh, it's ongoing?
 
Xeo
And it's not very far into the story either
The Light Novel is so much further
@SethCarnegie Yep
 
I didn't know とある means "a certain"
++japanese_level
 
Xeo
heh
 
5:18 PM
@Xeo why do you need two pairs of braces when initialising the member of a struct but not when creating a variable like std::array<int, 4> a { 1, 2, 3, 4 }
 
@Xeo Keeping it stylish...
 
Xeo
@SethCarnegie The second one relies on brace elision, which is allowed in exactly that situation
You can still use double braces
 
brace elision...
why have I never heard of that
 
It's more of a C thing. Up until uniform initialization constructors were common for C++ code.
 
So in this answer:
16
A: C++ vector of arrays

JohannesDUnfortunately, std::array does not have an initializer list constructor. Indeed, it has no user-defined constructor whatsoever -- this "feature" is a leftover from C++03 where omitting all user-defined constructors was the only way to enable the C-style brace initialization. It is IMHO a defect i...

should std::vector<std::array<int, 2>> vp = { {{1,2}}, {{3,4}} }; work?
the answer leaves it unresolved and I don't have a modern compiler
 
5:24 PM
I think so. I can give it a try.
Accepted.
 
Thanks
 
Opera has been broken on my laptop for quite some time now and Precise Pangolin has somehow made that worse.
 
Hey guys. a fast q. Would it be faster to use c++ to bind keys to another key than using autohotkey to do the trick. What I want is when I press a it should press space instead e.g.
 
C++ to bind keys? What?
 
Well. I want to make a script which would simulate a space pressed when i press the a key fx.
Just wanted to know if it would be faster to use SendKeys method than using autohotkey to do the trick
 
5:31 PM
Faster as in?
 
I have no idea what AutoHotKey is but I think it using it would be faster than doing it in C++
 
AHK can remap keys in a single line
 
Or just modify the keyboard layout.
 
yes but would the response be faster if I used SendKeys
how can i modify the keyboard layout
 
@CatPlusPlus Don't remind me that I spent several hours yesterday trying to figure out how to do exactly that x_x
 
5:39 PM
@Chrene Why should it? What do you think autohotkey does? (in fact, it probably doesn’t use SendKeys since Windows has better mechanisms of doing that – namely, you can create custom keyboard layouts)
 
It probably doesn't create a layout.
It involves creating and registering a DLL and then changing global settings and restarting applications.
 
0
Q: Variable declaration in the switch head?

Johannes Schaub - litbWhile browsing the code of my friend I came to notice this: switch(State &state = getState()) { case Begin: state = Search; break; // other stuff similar } What is with the variable in the switch header? He is using GCC so I think this might be a GCC extension. Any idea?

what is he pulling here
 
I like the secret tag
 
({..}) only works on class types
 
Sup with those flags (which I've invalidated by the way)?
 
5:55 PM
@JohannesSchaublitb replied. If it's totally wrong then say so quickly so I can delete it quickly :)
 
@StackedCrooked A variable definition is not an expression.
 
dammit
 
So... mine is correct then?
 
It's sound although I haven't checked the references you provided.
 
5:58 PM
@LucDanton unless the standard I'm using is a wrong version, I think you'd find them to be correct
 
@KonradRudolph Is that where they put the kids in the meat grinder?
 
Oh it's not about that, it's whether they're relevant. I'm not checking because well I think it'd be hard to get that wrong.
 
Oh ok.
 

« first day (560 days earlier)      last day (4389 days later) »