« first day (418 days earlier)      last day (4531 days later) » 

8:02 PM
@keith OP wants you to post an answer here: stackoverflow.com/q/8436438/46642
 
i wonder what &T::operator int&& &x; means in C++11 and C++03 !?
 
Right, you wonder.
 
@RMartinhoFernandes you're way behind. Also used my first rep-whoring standard reference. I feel so dirty.
 
struct T { .. }; T x; int main() { &T::operator int&&&x; } please investigate!
lol
 
Xeo
8:05 PM
@JohannesSchaublitb ((&T::operator int&) && x) in C++03, ((&T::operator int&&) & x) in C++11, max munching rule
I think I saw you answering that somewhere
 
Xeo
T needs to overload operator U(), operator&& and operator& though, I believe
 
you are wrong about C++03
 
0
Q: C++ has two copy constructors, both by reference and by value?

AmumuConsider this piece of code: class complex{ private: double re, im; public: complex(double _re, double _im):re(_re),im(_im){} complex(complex c):re(c.re),im(c.im){} }; I already knew that the copy constructor complex(complex c) wi...

 
Xeo
hm
 
8:07 PM
Copy constructors!
Again!
 
I think I saw that question a few minutes ago.
I close it as a dupe.
 
Xeo
@JohannesSchaublitb Ah, ((&T::operator int) && (&x))?
 
What's happening? Did I sleep and dream of closing questions on SO?
 
Fine. But upboat me first.
 
105
Q: Make a big deal out of == true?

JoelFanThere is a colleague of mine who constantly writes: if (someBool == true) It drives me up the wall! Should I make a big deal of it or just drop it?

 
8:07 PM
This is worrysome.
 
What exactly is the point of closing questions one year after they were asked?
 
Xeo
@RMartinhoFernandes No, new question, same asker
 
@FredOverflow I think the only justifiable reason is so they don't serve as examples for future askers.
@Xeo Thank god. That's a relief.
 
@RMartinhoFernandes He's asking a different question. I think he's wondering if it's valid to overload: complex(complex c) and complex(const complex &c)
 
8:09 PM
No, he's wondering why it even works at all to do complex(complex c)
 
his argument being that implicit copying should only go to the "correct" copy constructor
 
struct A { template<typename T> void operator T(); void f() { operator int&&(0); } }; valid in C++11 invalid in C++03. but if you put a "&A::"before the statement, it is valid in C++03 and invalid in C++11 xD
wait NVM! this trick does not work
I CALL IT BACK!
lol
 
> But why does it is not allowed? In Java, as I remember, it is. – Amumu 1 min ago
facepalm
 
He's just wondering, don't think harshly on curiosity
no matter how mistaken it is
 
Xeo
I think harshly on stupidity
 
8:13 PM
You really shouldn't since it can be corrected so easily
 
He supposedly already knows about infinite recursion.
 
@CatPlusPlus Yes he does. Since I just answered his question on that:

http://stackoverflow.com/questions/8436467/why-is-copy-constructor-not-allowed-pass-by-value
 
I think his name is Indian or something, maybe he's unable to make his question clear in English
 
@Mystical: He obviously doesn't, else he wouldn't be asking this question.
Regardless of what he claims, the fact is he doesn't get it
 
He says: Ah, so it's the ambiguity between the two function calls, since either passing by ref or by value, the caller uses the same function call. The compiler would mistake and call the copy by value constructor. Is my understanding correct?
 
8:15 PM
He didn't before he asked the question. But he does now.
 
Meatbags think in weird ways. That's something I've learned.
 
Hello everyone.
 
user142019
Hello.
 
hello friend
 
Could I get some help on my homework assignment? :D
0
Q: Trying to implementing a Stack and a Queue

OghmaOsirisI have an assignment where I read in a list of strings, add them to an array based stack and add the same list to a link-list based queue. The whole stack and queue are already written, my assignment was to add two functions to each of the derived Stack and derived queue classes to remove all of ...

 
8:16 PM
@RMartinhoFernandes, @Xeo: Take it easy on the newbies. You sucked at C++ once, too.
 
Read the OP, he mentions infinite recursion.
 
@SethCarnegie Correct. I think he's also wondering why the compiler can't "exclude" all the clearly invalid copy constructor candidates
 
@JohnDibling What did I do?
 
The problem is comparing with Java.
 
@RMartinhoFernandes I loved that game
 
8:16 PM
What game?
 
KOTOR
 
Why is everyone talking to me and not making sense?
 
you said meatbags
 
@SethCarnegie Oh, I see now.
 
8:17 PM
that's from KOTOR, the robot says that
 
user142019
Because you are awesome.
 
@RMartinhoFernandes What is the best programming language?
 
@RMartinhoFernandes what is the meaning of life
 
Brainfuck.
 
user142019
8:17 PM
Malbolge for sure.
 
I'm sorry I need to bother you with such a stupid beginner level c++ question but I just cant seem to get pointers to a multi-dimensional array right. I'm trying to build a class for  a simple octree. So I have this typedef which I hope gives me  an MD array of pointers to Octree instances

 typedef Octree* ChildOctrees[2][2][2];
 
Xeo
0
Q: Infer type from nested STL template

HookedHow to I get my class to infer the inner type of a parameter without explicitly referring to it? Look at the minimal example below: #include <vector> template <class T> class foo { public: foo(std::vector<T> &x) : _x(x) { T dummy = x.front(); // Trying to tric...

 
@RMartinhoFernandes How can I rotate a spreadsheet?
 
Xeo
These kinds of question are really way too common
 
No, this is nightmare, I'm sure.
 
8:18 PM
@CatPlusPlus Since I'm awesomer, I'll just talk to myself.
 
Multidimensional arrays now?
OMG.
 
user142019
One can write any language in C++.
 
Xeo
Because people are spoilt by template parameter inference of function templates
 
@RMartinhoFernandes: yes its pretty lame
 
8:21 PM
I think it might be good to have a reading requirement before you can ask questions on SO
 
@JohannesRudolph Oh, don't take it badly. It's nothing personal. It's just that I'm tired of questions about multidimensional arrays. We need an answer we can refer people to.
Questions about multidimensional arrays are stalking me. I'm sure. They want to eat me alive.
 
How about...
...don't use multidim arrays?
 
Xeo
@RMartinhoFernandes I'm sure we have one
 
Nevermind.
 
Boost.MultiArray FTW.
 
8:22 PM
@JohannesRudolph ask the question properly on SO and you'll get some answers to help
 
@RMartinhoFernandes There's one I linked above. It's just not approachable
 
Xeo
31
A: How do I use arrays in C++?

FredOverflowProgrammers often confuse multidimensional arrays with arrays of pointers. Multidimensional arrays Most programmers are familiar with named multidimensional arrays, but many are unaware of the fact that multidimensional array can also be created anonymously. Multidimensional arrays are often re...

Should cover it
 
look, I get how pointers work and all that
its just the combination with a typedef that makes me struggle
 
Ok, but what's the question?
 
typedef Octree* ChildOctrees[2][2][2]; creates a three-dim array of Octree pointers, I think.
Well, type of three-dim array of Octree pointers.
 
8:23 PM
@JohannesRudolph did you try what you posted earlier
 
go go boost::array
 
yeah, boos.MultiArray is nice and all, but I wanna write a plain, lazy Octree and hence the array does not need to allow for growing
 
boost::multi_array actually.
 
boost is teh bloatz
 
and not wanna pull in a dependency on boost, it's just a stupid c++ Uni assignment
 
8:24 PM
Bullshitz.
 
c# is my mainland, sorry guys
 
What's the question?
 
TR1 and C++11 have array as well
 
Boost being a dependency is not a problem.
 
how do you know?
 
8:24 PM
You said you had trouble, but you didn't ask anything.
 
Boost not being a dependency is often a problem.
 
right, so I have that three-dim array of Octree*. Now I wanna have a class have a pointer to that 3d array of Octree*
 
@CatPlusPlus nice
 
ChildOctrees*
 
8:25 PM
Why do you want a pointer to array?
 
Xeo
@JohannesRudolph Octree* (*ptotree)[2][2][2];
 
Also what robot said.
 
Xeo
I think
 
For any serious project I'd sure use boost
 
8:26 PM
Really, raw arrays are just ugly and full of nasty surprises.
 
no reason to deny that
 
Xeo
And initialize with &ChildOctrees
 
ChildOctrees is a type, silly.
 
raw arrays are awesome
 
@Xeo Typedef.
 
Xeo
8:26 PM
Oh
Well
Overlooked the typedef
 
Xeo
Then it's really just ChildOctrees*
 
Twice.
 
I could use another approach if feasible
take it like this: An Octree is either a leaf or it has 8 child Octrees
 
> make[1]: Leaving directory `/home/PiotrLegnica/build/share'
 
8:27 PM
Boost.Optional :P
 
WEEEEEE IT BUILT CORRECTLY
 
Oh, being normal is the point.
 
I know, that's the point.
 
So, was there a reason why you wanted [2][2][2] rather than [8]
 
It's not an error.
IT'S NOT AN ERROR!
 
8:28 PM
Ok, I get it.
 
@SethCarnegie: It's more intuitive than [8] and manually calculating your indices
 
Dammit.
 
at least, if you don't struggle with the freaking syntax
 
I keep pressing up to recall previous message, and it goes to editing.
Stupid IRC.
Or stupid chat.
 
8:29 PM
I haven't decided yet.
 
Xeo
Both
I miss the editing feature in IRC :(
 
@JohannesRudolph So then is your problem solved yet
 
Xeo
Maybe they should make a new protocoll that allows it
 
And call it... Wave!
Oh wait.
 
nope,

class Octree
{
private:
ChildOctrees* childOctrees;
 
8:30 PM
class Octree
{
private:
ChildOctrees childOctrees[2][2][2];
 
Xeo
multiline markdown wins against everyone the first time
 
I don't get what your problem is still
 
@JohannesRudolph Well, you declare the pointer as ChildOctrees* my_superbly_crafted_pointer_that_menaces_with_spikes_of_granite and access it like (*my_superbly_crafted_pointer_that_menaces_with_spikes_of_granite)[x][y][z]
 
ChildOctrees is already [2][2][2] array.
[x][y][z], you mean.
 
Yeah, that.
I got carried away by the spikes.
 
8:31 PM
ok, leaving jagged versus true MD array aside
 
Oh ChildOctrees is the type
so then I still don't know what the problem is :)
 
@JohannesRudolph They are not jagged now.
 
I wanna have that array not taking up any space if my Octree is a leadf
 
You allocate with new ChildOctrees
 
[][][] is jagged AFAIK vs. [,,,] is MD
 
8:31 PM
MD?
 
@JohannesRudolph No, the second is not valid C++.
 
not in C++
 
Medical Doctor?
 
Molecular Disruption.
 
Alright, MD := MultiDimensional
 
8:32 PM
Well, when you look at it closely, [,,,] kind of resembles Zoidberg.
 
think Delphi has it as does the .NET CLR
 
int a[5, 7, 9]; declares a one-dimensional array of size 9. The 5 and 7 are ignored by the comma operator.
 
CLR is not a language.
 
Xeo
8:33 PM
@FredOverflow a[idx(6), 7, 8] might work. :D
 
I doubt IL needs sugar for array indices. :P
 
Xeo
depending on operator overloads :>
 
I just wanted to refer to the whole ecosystem. C# doesnt expose it. Think only stupid VB does it
 
Well, you declare the pointer as ChildOctrees* my_superbly_crafted_pointer_that_menaces_with_spikes_of_granite and access it like (*my_superbly_crafted_pointer_that_menaces_with_spikes_of_granite)[x][y][z] and allocate with new ChildOctree.
That's all.
Not jagged.
 
It's always a language feature.
 
8:33 PM
Also, there is no such thing as int[][] in C++. All but the first dimensions must be specified.
 
There is no "ecosystem".
 
I can refer you to the ECMA spec of you really want to
 
Of what? Visual Basic?
Thanks, but no. :P
 
nope, of the CLR and CLI
 
0
Q: Does inverting the "if" improve performance?

user1081727I've been using resharper for a while now and sometimes it suggests that I invert the if. I guess an example would be a better explanation of my situation : public void myfunction(int exampleParam){ if(exampleParam > 0){ //do something with form controls for example } } Now ...

The mother of all premature optimisation
 
8:34 PM
but guess you C++ guys are not interested :-D
 
I don't know how is that relevant.
 
user142019
Me neither.
 
man
parsers are too much code
I'm running through 700 lines :(
 
lol
mine is...
 
user142019
What do you want to parse?
 
8:35 PM
@SethCarnegie I'd post a link to the Sesame Street "Measure" song, but I'm tired.
 
 cannot convert from 'Octree *(*)[2][2]' to 'ChildOctrees (*)'
 
my custom language
 
user142019
Cool!
 
@JohannesRudolph What caused that?
 
See, ugly arrays.
 
8:36 PM
it will be when I'm finished, which will be soon, hopefully
 
Xeo
damn, pc crash -.-
 
mine is 1200 lines and it's done
for now
 
ChildOctrees* octs = new ChildOctrees();
 
harhar
 
actually a little lesss
 
8:36 PM
I DRY better than you
 
439 semicolons
 
or have a simpler grammar
 
user142019
@Xeo pc crèche
 
:P
 
with typedef Octree* ChildOctrees[2][2][2];
 
Xeo
8:37 PM
Atleast my system is up again in no time thanks to my awesome SSD <3
 
why does Ctrl+K not work properly in chat for selections?
 
@SethCarnegie Does anyone dare to ask "What's the most efficient infinite loop?" on SO? I don't want to spoil my reputation :)
while(1);
while(true);
for(;;);
inifinite: goto infinite;
^ candidates
 
user142019
Wish I had an SSD.
 
What's Ctrl+K?
 
user142019
kill line
 
8:37 PM
Also, chat hijacks it for fixed fontness.
 
user142019
An Emacs, readline and Mac OS X shortcut.
 
Format as Source Code, works in the normal SO markup editor
 
@FredOverflow while 1: is more efficient than while True: in python at least :)
 
dd is kill line.
Also, kill is silly term for that.
 
8:38 PM
@SethCarnegie Why? :)
 
@CatPlusPlus: dd is vim isnt it
 
@FredOverflow Because it didn't optimize.
 
user142019
yuck, vim
 
Yes, it is.
 
@FredOverflow well, in python < 3
36
Q: while (1) Vs. for while(True) -- Why is there a difference?

AndrewFIntrigued by this question about infinite loops in perl: http://stackoverflow.com/questions/885908/while-1-vs-for-is-there-a-speed-difference, I decided to run a similar comparison in python. I expected that the compiler would generate the same byte code for while(True): pass and while(1): pass, ...

 
8:39 PM
Also, very unlikely on PyPy.
 
Oh, someone got my MD reference!
 
@DeadMG what is your language like
 
Also, the difference is more than likely negligible.
 
Was it the puppy?
 
user142019
@SethCarnegie try while(0) in ruby
 
8:39 PM
statically typed I presume
 
> In other words, True is reassignable
 
yes
 
@SethCarnegie lol
 
@WTP 0 is true in ruby isn't it
as in lua
 
user142019
@SethCarnegie yep. Only nil and false are false.
 
8:40 PM
yes, I got your reference, and yes, my language is most assuredly statically typed
 
Python had no True and False in the beginning, hence why backwards compat stuff in 2.x.
 
I didn't get my reference
it's dumb to capitalise true and false
 
1 min ago, by R. Martinho Fernandes
Oh, someone got my MD reference!
@SethCarnegie Was a reply to me.
 
user142019
8:41 PM
@SethCarnegie you haven't seen Objective-C then :p
 
Xeo
@SethCarnegie In an answer to that, in a comment
> With True = False, Python 2 can run an infinite loop in no time
 
It's dumb to capitalise function names. It's dumb to capitalise class names in C++.
Style be style, it doesn't really matter.
 
user142019
@CatPlusPlus depends.
 
Xeo
It's even dumber to force capitalization rules on your users if you're a language
 
Xeo
8:42 PM
looks at Java and C#
 
Java?
 
@Xeo What do you mean?
 
You clearly never used a functional language.
 
java likes camels
 
I like to capitalise class names and not capitalise function names
 
8:42 PM
@Xeo You may have a point (debatable) but you picked the wrong examples.
 
theres nothing forcing you to use Capitalized class names in C# as well as Java
As long as its consistent I wouldnt care
 
Xeo
@RMartinhoFernandes I menat in general, not class names. toString etc and the interfaces need a required capitalization
 
Erlang, Haskell, OCaml all force capitalisation of stuff.
 
user142019
It's dumb to prefix class names with a C character.
 
@Xeo No, they don't.
 
Xeo
8:43 PM
@RMartinhoFernandes Really?
 
You can pick real examples, if you want.
@Xeo No.
 
Interfaces and language syntax are two different things.
 
Xeo
Then disregard whatever I said. :P
 
Only keywords have a fixed case.
Everything else is whatever case you want.
 
can a bunch of if/else ifs be optimised/are they usually optimised into a jump table like a switch can be/usually is
 
8:44 PM
In Haskell, you have to capitalise type names, type class names and type constructor names.
And not capitalise function names and variables.
 
typedef Octree* ChildOctrees[2][2][2];

....

ChildOctrees* octs = new ChildOctrees();
// error C2440: 'initializing' : cannot convert from 'Octree *(*)[2][2]' to 'ChildOctrees (*)
 
OCaml has similar rules.
Erlang requires variables to start with uppercase letter, because lowercase letter identifiers are atoms.
 
@JohannesRudolph That's why you should use boost::array and not primitive arrays.
 
anyone can tell me how I would alloc that ChildOctrees* octs =... properly?
 
user142019
In Ruby uppercase variables are constants. Is always <strike>nice</strike> if I'm trying to do XML = something or similar.
 
8:45 PM
and I hope that you're not going to disregard our advice about getting a class wrapper and then ask us for help with the problems that you wouldn't have if you followed our advice previously
 
ChildOctrees* octs = new ChildOctrees;
 
@DeadMG: Boost has been mentioned ten times by now and Yes I know it exists and NO im not gonna use ithere
 
user142019
But I'm going to sleep. o/
 
@WTP Triple dashes before and triple dashes after to strikeout.
 
@FredOverflow no he's trying to do the [2][2][2] array pointer
 
8:47 PM
T*x = new T;   // what else would you write on the right side?
 
@FredOverflow: why would leaving out the () help? Does generate the same error
 
@JohannesRudolph Well, happily add to my ignore list. I have no desire to watch you complain when I have already told you how to solve your problem.
 
You're going to spend all night on those bloody arrays, you know that, right?
 
@JohannesRudolph What error? What is the definition of ChildOctrees?
 
typedef Octree* ChildOctrees[2][2][2];

....

ChildOctrees* octs = new ChildOctrees();
// error C2440: 'initializing' : cannot convert from 'Octree *(*)[2][2]' to 'ChildOctrees (*)
lol
 
8:48 PM
@FredOverflow It's weird ideone.com/rkNHp
 
Maybe the typedef syntax is off.
 
@SethCarnegie Are you sure you want an array of pointers?
 
@FredOverflow I don't, he does
 
Xeo
Great
 
I want a pointer to an array of pointers
 
Xeo
8:48 PM
I love it when my router just decides to kill the WLAN signal
 
typedef Octree* (*ChildOctrees)[2][2][2];   // this is a pointer to a three dimensional array of pointers
 
You'd write array by now.
 
@FredOverflow But then he doesn't want to new up one of those pointers.
 
anyways
I'm going to Hit The Sack™
nighty nights
 
hahahaha, someone cleared the stars off of Johannes' line: "@DeadMG: Boost has been mentioned ten times by now and Yes I know it exists and NO im not gonna use ithere"
 
8:50 PM
Why do you have to study for 5 years....
 
Boost has been mentioned more than ten times.
 
It's horrible
 
yes, boost is horrible
I agree with Man of One
 
Xeo
oO
 
we're a team
 
8:51 PM
Why is everyone changing their avatar to a picture of theirs?
Also, use boost.
Boost is as much a dependency as is the standard library.
 
0
Q: How to write good cheatsheets? Are there templates?

cl_progger) I want to write a cheat sheet, but I don't know how to do it. I want to focus on the content and not on the layout, so I am searching for templates, which are not too complex to use. Do you have any ideas? Scribus, LibreOffice, Latex? Something like css cheat sheet would be great. But unlike th...

 
@FredOverflow: That compiles at least, bonus points if you could explain WTF that typedef means. I mean not on the big picutre, but e.g. why I need (*ChildOctrees) in there
 
@RMartinhoFernandes I've still got the good old puppy
 
It's just c++ syntax
 
I don't even have any pictures of me.
 
Xeo
8:52 PM
@DeadMG Admit it, your are the puppy
 
@JohannesRudolph You said you wanted a pointer to an array of pointers. That's just normal C declarator syntax.
 
All the gurus have a real pictures, Fred, Johannes and sbi.
 
Xeo
@ManofOneWay sbi?!
 
@JohannesRudolph How did you allocate it?
 
sbi is an undercover agent of Sexual Bureau of Investigation.
 
Xeo
8:53 PM
Take a look at the picture again.
 
ChildOctrees* childOctrees = new ChildOctrees;
 
lol
@JohannesRudolph But now that's a pointer to a pointer to an array of pointers!
 
@Xeo No, really, that is sbi
 
Xeo
@CatPlusPlus "sbi bureau of investigation"
 
the real pic
 
8:53 PM
@RMartinhoFernandes it always was...
 
@JohannesRudolph Maybe you can explain to me what you actually want, I haven't followed the design discussion yet.
 
@RMartinhoFernandes Lol.
 
Xeo
Oh, you're trolling. I take that you were trolling to when you said Boost is horrible
 
Why do you trust random people on the Internet?
 
I forgot awoodland also.
 
8:54 PM
Also, even if I had pictures of me, the cat is prettier.
 
@ManofOneWay que?
 
Your avatar, it's your picture.
 
Then we have the "almost guru": RMartinhoFernandes, DeadMG, Luc and cat
 
Or someone else's you stole.
Ha, DeadMG is "almost guru"! lol
 
I'm nowhere near being a guru.
 
8:55 PM
@JohannesRudolph You want a pointer that (optionally) points to an array of Octree pointers, right?
 
Robot, puppy and Luc are way better than me.
 
Yeah, right.
 
Octree* (*p)[2][2] = new Octree*[2][2][2];   // no need for the typedef
 
@FredOverflow: yes, exactly that
 
@FredOverflow Why can't you keep the first extent?
 
8:57 PM
I ahve just included the typedef as seen here stackoverflow.com/a/1052837/125407
 
@RMartinhoFernandes array-to-pointer decay
 
Oh.
Dammit.
So, what's the lesson? Use boost.
 
Or wrap the three-dimensional array in a struct.
 
It's always the lesson.
 
Or stop worrying and love the C declarator syntax (and array-to-pointer decay).
 
8:58 PM
Or: Conform
 
Im probably gonna go the struct route
 
Conform to what?
 
but its pretty ugly to
 
to everyone using boost
 
Xeo
Or: Just use a fucking single dimensional array
 
8:58 PM
Nooooooo noooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo Oz crashed again.
 
Once you learn how to read the C declarator syntax, it's really not that complicated anymore.
 
WHY.
WHY ME.
 
lose your individuality in its mass of templated gunk
 
Xeo
@CatPlusPlus THERE IT IS! I waited for it!
@SethCarnegie Working code > individuality
 
1 hour ago, by Xeo
Waits for @Cat's next scream saying that it crashes again
 
8:59 PM
Working code + individuality > working code
 
@SethCarnegie I have no problem with using boost, its just not what is appropriate here
 
You don't use boost, boost uses you
 
Code and individuality should be completely disjoint.
 

« first day (418 days earlier)      last day (4531 days later) »