« first day (705 days earlier)      last day (4226 days later) » 

11:00 AM
now than a + b is an rvalue?
because that's an expression, so it has valueness quality, right?
 
usually, but you could overload it to produce an lvalue
 
what by just operator+ overloading?
 
ep
 
Just think of rvalues as things that you cannot take the address of.
 
strictly, there's nothing stopping you from doing, say, int& operator+(my_class a, my_class b) { static int x; return x; }
but I have never seen nor used any code where operator+ did not produce an rvalue
it's more of a theoretical possibility
 
11:03 AM
@Aesthete i cant find all the include's like cctype isnt there :O
 
@ManofOneWay yes, but then you cannot take the address of any expressions that I've seen, which means they're all rvalues.
wait wut?
 
Hi. :3
 
@TonyTheLion Are you thinking of any particular expression that seems weird?
 
actually, thinking about it, I may just not be familiar enough between the differences of expressions vs statements
 
all expressions are valid statements, but not vice versa
 
11:13 AM
yea that really tells me alot
 
heh
sorry
expressions do things- like call functions, use operators, produce values, etc.
statements tend to declare things- variables, control constructs, and such things
 
> In most languages, statements contrast with expressions in that statements do not return results and are executed solely for their side effects, while expressions always return a result and often do not have side effects at all.
right
but it's the result of an expression that would have the value-ness property, right?
 
yep
 
statements don't have value-ness at all, they don't produce values
 
11:18 AM
right
makes sense
> unknown exception
very useful. Meh
 
@TonyTheLion Of course you can. You can't take the address of anything except an expression.
when you do int a; int* p = &a; then a is an expression.
or int* p2 = &*p; *p -> expression
&vector[0]- vector[0] is expression
you get the picture
 
Xeo
Stupid flags first thing in the morning.. because somebody said "boobs"...
 
boobs
 
amagad flag!
you're all ugly
 
11:35 AM
well, thank you
@DeadMG int* p = &a; this looks like a statement to me? Or is it really just a in there that's considered an expression?
0
Q: Which one is important? Extra lines of code or memory Consumption

Waji ShahWhat Programmer should care about while coding, extra lines of code or memory consumption. May be some scenerio take less code but consumpt more memory or vice versa.

lol
 
Entire RHS is an expression.
 
ah RHS
0
Q: Can a dynamically allocated shared_ptr delete itself via the dtor of the object it's managing?

Martin JamesWhen answering another question, it occurred to me that I maybe optimize some of my own older code that has err.. 'less than optimal' lifetime management. I have at least one app where access/lifetime an object is controlled with a shared_ptr. This ptr is dynamically allocated so that it can be ...

fail.
 
-5
Q: What's wrong with singleton?

Jakub ŠturcDo not waste your time with this question. Follow up to: http://stackoverflow.com/questions/137975/what-is-so-bad-about-singletons Please feel free to bitch on Singleton. Inappropriate usage of Singleton may cause lot of paint. What kind of problem do you experienced with singleton? What is c...

> Inappropriate usage of Singleton may cause lot of paint.
5
lol
 
void swap(char **a, char **b)
{
        char* c = *a;
        *a = *b;
        *b = c;
}
what the fuck is that???
 
11:51 AM
@TonyTheLion swapping C-style strings?
or something
erm
 
swapping pointers
 
@FredOverflow downvotes at the ready!
 
@TonyTheLion It's std::swap but sucks a lot more.
 
anways, the question I was trying to answer, didn't need a swap
 
11:57 AM
@FredOverflow I think he meant 'gaffer tape'
 
meh, a zillion linker errors
:(
 
never in all my years have I ever seen any one use a while loop as an if
 
@thecoshman while(x) { dostuff(); break; }?
 
0
Q: big oh notation10

Majid AlfazariProblem: The following program estimates the probability that two random numbers are prime double probRelPrime( int n) { int rel = 0, tot = 0; for (int i=1 ; i≤n ; i++) for (int j=i ; j≤n ; j++){ tot++; if (gcd(i, j) == 1) rel++; } return (double) rel/tot; } Whe...

close
 
> j≤n
 
12:03 PM
@DeadMG almost, while(x){x=false; dostuff();} sure there is a chance that whilst do stuff is run x could be set back to true, either in doStuff() or from another thread, it's just such a strange thing to see
 
don't think C++ supports the ≤ symbol
 
@DeadMG not within the code it self no
 
then the `while` would not be used as an `if`, but as a data race
poor man's spinlock emulation? (Kill it with fire)
 
@sehe true, not really a proper 'if' but just very strange thing to see. Especially as if you read that snippet and did not know how the code was structured, you are not given any justification for the while loop
 
12:27 PM
OK, I have to accept somebody. After rock/paper/scissors with Anne, you won! — Martin James 14 mins ago
4
lol :)
Hey guys, I got a shiny new bike and I'd like to do the washing-up with it! Is it possible? — H2CO3 58 secs ago
hahah
 
> A file on disk does not have an address.
this is wrong
you can, in fact, map virtual addresses to file contents
 
with mmap like the guy said in the comments?
hmmm
 
dunno about mmap, that's a Unix system call
and I'm a Windoze guy
 
yes well, mmap is the same as MapViewofFile in windows
 
ah
in that case, then yes
whilst strictly, the file doesn't have a physical address, this fact is invisible to the end-user program, which can treat the file as just another chunk of teh memories
 
12:42 PM
right
but my point was that you cannot (as in it's not visible to us users) get an address of something on disk without loading it in memory
only the OS can swap things out to disk that are in memory, but to use them, has to load them back in memory
afaik
 
I suppose you could say that's true
but the OS manages the loading from disk, and flushing back to disk, so this process is invisible to the program
 
true
turns out OP just wants to open and read file
lol
 
lol
 
guess he may not be a computer wizz kid then
class Class {
    public virtual method()
    {
        this->~Class();
        new( this ) Class();
    }
};
isn't this UB?
 
strictly, no
 
12:50 PM
ah ok
 
but it can become UB if extreme care is not taken
 
well, files are stored at a physical location on a hard drive, and as such, their is an address for it, though not in the same sense as an address in RAM
 
and it's generally Very Bad™
and should be burned with fire
 
@TonyTheLion ¬_¬ is that trying to replace the runtime object with a new type?
 
@thecoshman Yes, from here:
2
Q: Does destroying and recreating an object make all pointers to this object invalid?

sharptoothThis is a follow-up to this question. Suppose I have this code: class Class { public virtual method() { this->~Class(); new( this ) Class(); } }; Class* object = new Class(); object->method(); delete object; which is a simplified version of what this answer s...

@DeadMG you should tell OP then, see link ^
 
12:54 PM
@DeadMG isn't any use of this other than comparison after a destructor UB?
 
@rubenvb Nope.
 
oh.
 
it's my understanding that the Standard contains a non-normative note explicitly stating that the above is well-defined behaviour
but remember, after destroying this, it's only illegal to access the members- that memory is still valid.
 
right.
 
if this was illegal, then it would be impossible to implement, say, containers, especially vector.
 
12:59 PM
really? I thought simpler stuff was used.
 
would this macro print the type of x at compile time: #define print(x) static_assert(false, decltype(#x))
 
@rubenvb Not really.
they're based on the fact that you can repeatedly construct and destruct in the same bit of memory
@TonyTheLion No.
that wouldn't even compile
static_assert being passed a type?
 
even if you did static_assert(false, #decltype(x)), which would be closer to your original meaning, I don't know if the preprocessor would accept that, and even if it did, all you'd get from the error is "decltype" or "decltype(x)".
 
hmmm
so I guess what I'm trying to do isn't possible
I thought Andrei suggested doing something like that in that video I watched yesterday
 
1:02 PM
@TonyTheLion Nope.
 
something about learning from videos comes to mind :P
 
it's pretty much impossible to get a compile-time string naming a type
 
isn't typeid compile time?
 
@rubenvb not for lvalues or pointers of dynamic type
There's no good reason why type_info::name() shouldn't return a constexpr string, though.
 
1:08 PM
this prompted my question
 
RTTI is called RTTI not CTTI for a reason.
 
oooh, two new mobs in MC, one hostile one peacfull
 
Did anything happen to C++ while I was away?
 
@Potatoswatter yes, it is now patented by Oracle
 
LOL. But at least Itanium support is still guaranteed.
 
1:12 PM
@thecoshman mc?
 
@DeadMG Minecraft
 
people still play that junk?
 
Apparently so
 
hmm
 
@DeadMG I know it's shocking isn't it! A fun game, being played! What ever next, people expecting films to be entertaining, wanting food to be tasty?
 
1:15 PM
why does it take three hours to fly to Linz, but only an hour and fifteen minutes to fly back from Linz?
 
@DeadMG where is Linz?
Belgium?
 
Austria
 
@thecoshman No, but this is like expecting people to watch an entertaining film from like, 2 years ago. No way.
 
@thecoshman maybe that's why. It takes longer when the pilot has to find the place
 
@thecoshman Minecraft is a fun game?
 
1:16 PM
once he's there, getting away is easy enough
 
@Potatoswatter oh right, I forgot that things suddenly lose all value once they reach some random age
@DeadMG if you enjoy an open-ended sandbox game which provides you lots of things to play with and challenges to overcome, and has had new features added it more or less every week for over a year, if you accept the snapshots
 
@CatPlusPlus good point.
 
@jalf I like to think pilots do not require me to randomly guess where places are
 
@DeadMG Yes.
 
Our software should be named "slowpoke". It takes a good 5 minutes to load an empty form screen.
 
1:20 PM
Personally, I prefer open-ended sandbox environments where you can actually construct what you want in a reasonable period of time and actually attempts to promote you doing what you want to, instead of pointlessly jerking you around
 
@CatPlusPlus but how, all you do is use you imagination and play around with out the need for someone to tell you what to do
@DeadMG ah, you see, what you did is completely ignore 'creative' mode
 
@thecoshman Sounds like writing code or using a modelling tool, except you can't build anything useful or imaginative.
@thecoshman Actually, I did play that for a little while.
but if you want to build a wall N blocks high, then you have to waste N hours of your life endlessly jumping up and down and placing every goddamn block
 
@DeadMG no tool is perfect. There are always limitations. But of the challenge, and thus the fun, is working within those limits
 
@DeadMG What.
 
@thecoshman There's no challenge in "You can do whatever you want, it's just going to take forever- almost literally for anything more complex than "Look ma, a wall!"
 
1:23 PM
ok, just shut up. Everyone here should know by now that @DeadMG still is at the mental age where it's cool to protest and object and tear everything down. There is absolutely no goddamn point in spending the next hours going "what" and "are you kidding" and pretending that you somehow don't understand the other party
7
You disagree about a fucking game, that's great, end of story
 
lol
 
@DeadMG if it can be done instantly, then there is no challenge, and thus no reward, even if self given, and thus no fun.
 
Omg, you guys are starting to sound like me and <insert name of person I've argued with here>
 
hey, it seems to have worked! :D
 
Yahtzee (spelling) summed it up very nicely, you can't help but take great satisfaction build a giant golden cock
@jalf doubt it, I suspect lag or food
 
1:28 PM
@jalf heh, nice way to kill the argument with fire. :) Well done :)
 
@TonyTheLion one day the puppy will need to grow up
 
@thecoshman one day everyone will need to grow up. :)
 
Question is: Do we want to grow up? :)
 
@jalf ah, but some of us are already to understand why the opposing party might hold a certain view, even if we our selves disagree with it. Some of us are able to accept others having their own view
@TonyTheLion well, I sure do like being allowed to drink the booze
 
@thecoshman that merely has to do with your physical age, not with how you actually behave.
 
1:33 PM
What's more, some of us are able to admit when we are wrong
@TonyTheLion indeed
 
@TonyTheLion We don't, actually, behave
 
A sibling of mine is grown-up physically, however behaves like a child.
 
trololololo
 
@sehe ¬_¬ I don't get it
 
@thecoshman yes, well that takes being able to be wrong in the first place, which a lot of people have a hard time with.
@sehe your mum.
 
1:36 PM
@TonyTheLion yeah, there does seem to be a bit an infection of 'never wrong-itis' around the place
 
People instinctively want to be right and will do anything to assert that rightness, even in situations where it makes absolutely no sense. Being right is survival, being wrong is not survival, we want to survive, so want to be right.
Obsessively trying to be right about some flagrant wrongness is where it gets silly.
Recognizing it in yourself, however, is not always easy. :)
 
Well, if we weren't also innately able to overcome that, we wouldn't be so successful. Psychological balance is perhaps what separates the men from the higher apes.
 
Actually, sometimes and especially when you are young, people don't take you seriously if you say something like "I could be wrong but...".
 
@Potatoswatter Yes, true, what I'm saying though is that some people have a hard time at times overcoming that obsessive being right thing where they are obviously just wrong, and admitting being wrong would just be much easier. Sometimes you have to accept being wrong, and learn from it. It comes easier for some then others. IMHO
 
And there is pretty much nothing you can do against an older person that you know is wrong.
 
1:39 PM
@ereOn indeed, admitting you are open to the fact your could be wrong does seem to come across to the world as 'I am making this up'
 
@ereOn that's something else, that brings into factor who you're talking or arguing with. I'm speaking more general.
 
@TonyTheLion Yeah. I tend to believe in environmental factors above genetics in psychology, but the pain associated with being wrong may be an exception. Even babies have very different personal responses when they are wrong.
 
Sure. But in this case what's the alternative ? Because if you keep saying "I'm sure that.." and go wrong several times, people will start to believe you are too confident and always mistaking.
 
@thecoshman Pandemic is the word
 
@Potatoswatter I'd say it depends a lot on how the environment reacts to you being wrong.
 
1:41 PM
@Potatoswatter hi btw. Long time no seen, I believe
 
@sehe It's rampant.
 
@sehe indeed it is
 
If you are surrounded by idiots that won't miss a chance to highlight your mistakes, then you are more inclined to hide them.
 
@StackedCrooked o_0 that's something else entirely :P
 
My theory is that most engineers used to be smarter than the other kids when they grew up. Therefore they are so used to being right that they started to assume that they are always right.
 
1:42 PM
@ereOn then you point out their logical fallacy (some one link up that bad boy) and thus you win
 
@sehe Yeah… I've been off fighting with JavaScript etc.
 
@StackedCrooked nice theory
 
anyways, back to code
 
@StackedCrooked I noticed that more engineers are only children or from small families. So it could be the other way around, that more self-confidence gets one a jump start in engineering.
 
@Potatoswatter: What do you mean by "small" families ?
Families with a few kids ? Or with few relatives ?
 
1:44 PM
@ereOn Few siblings. A larger win percentage in home conflicts.
 
@Potatoswatter I have a brother and a sister. Don't know if that counts as a small family.
 
@StackedCrooked Assumptions, that's where the problem begins.
 
I'm not sure that holds. My gf's family is rather small, but almost any of them would ever admit their mistakes.
 
I have two sisters and a brother, which always seemed like a big family. But we're all scientists/engineers.
 
well, to solve this, you would need to get a chart on the go, engineers and non-engineers against number of siblings. See what the data says
 
1:46 PM
@thecoshman Great. I'll be expecting the results by tomorrow!
 
Xeo
0
Q: How could it be pissible!!! 255x256x256x256=18446744073692774400

user1624507I encountered a strange thing when I was programming under c++.It's about a simple multiplication. Here is my code: unsigned __int64 a1 = 255*256*256*256; unsigned __int64 a2= 255 << 24; // same as the above cerr()<<"a1 is:"<<a1; cerr()<<"a2 is:"<<a2; interestin...

> pissible
 
That's impissible !
3
 
@thecoshman Huh, I would have expected Google to find some studies but apparently not. There's probably a particular journal with that kind of study, and it's probably a hundred bucks to get the relevant article :P
 
impissibru!
 
Xeo
1:50 PM
Crap, I think that question will get a ton of upvotes because of some trivial type stuff...
 
-1 Not enough punctuation marks. — Cat Plus Plus 44 secs ago
 
Question voting is so useless.
 
@StackedCrooked warning, data my invalidated due to small size and bias in samples
 
Xeo
Well, the question and especially the first answer
 
1:52 PM
@Xeo how's the job hunting?
 
@Xeo Seriously, do I need to answer another question with nothing but compiler output?
 
@Xeo It's a pitfall that was mentioned in the Clang talk during the Going Native event. Clang should warn about it.
 
Xeo
@TonyTheLion No email from the Funatics guys yet :/
 
ARgh. Whoever teaches C++ and doesn't mention compilers are designed to make your life miserable unless you turn warnings on, should be shoot.
 
@Xeo :/
 
1:54 PM
@R.MartinhoFernandes Compilers are designed to make your life cushy when you turn warnings on. FTFY
 
Hi all, in what languages can I use a Canvas?
 
@R.MartinhoFernandes shot?
 
C++ however is designed to make everything complicated.
 
Xeo
@Tgys struct Canvas{}; -- in C++.
 
@Tgys: In Canvas++ perhaps.
 
1:55 PM
lol
 
lol
 
@Tgys An HTML canvas is useless without JavaScript.
 
@TonyTheLion Yes.
 
But aren't C# Canvasses much more awesome?
 
More awesome than ?
 
1:56 PM
@Potatoswatter <
 
@Tgys any language that allows you to define variables with that name, or types with that name
 
@Tgys Stop kidding around. You got your answer ;)
 
> Exercise: For const int*, is it a const pointer to int, or a pointer to const int?
@DeadMG you haven't explained that in the tutorial, seems wrong to ask that there.
 
@thecoshman Got it, thanks!
@KendallFrey So the answer is, any language.
 
@Potatoswatter C++ is however is complicated because it is designed to make anything
 
Xeo
1:57 PM
0
A: Initializing std::vector with iterative function calls

jrokA crazy idea - a struct that generates a value upon the call to its conversion operator to the value type of the vector: #include <vector> #include <iostream> struct implicit_generator { explicit generator(int i) : i_(i) { } operator int() const { return i_++; ...

How one little "typo" can change an answer...
 
@thecoshman It gets complicated when we attempt to make everything and anything.
 
@Potatoswatter indeed
 
The more I use JavaScript the less I understand why anyone would choose Node.js over a language that can warn you against common, minor errors.
 
@Xeo can you confirm that VS warns on that code with the overflow?
VS has weird warnings...
 
We got a raw recruit who's never used anything but PHP, and I have to apologize to him for Java and JavaScript being so ugly. Sad story.
 
Xeo
2:00 PM
@R.MartinhoFernandes > warning C4307: '*' : integral constant overflow
 
@Xeo Ok, cool. Thanks.
An annoying thing about C++ compilers is that using them without turning warnings on will let you make tons of mistakes you shouldn't have to. When I compile this code in GCC with g++ -Wall -Wextra -pedantic, the compiler tells me quite clearly: "q12514027.c++:5:33: warning: integer overflow in expression [-Woverflow]". Microsoft Visual Studio also diagnoses this problem: "warning C4307: '*' : integral constant overflow". I hope this serves as a lesson to compile with warnings on in the future. — R. Martinho Fernandes 2 mins ago
 
@Potatoswatter hahah
 
@thecoshman Partly -- but a large part of the complexity is from grafting it onto the top of C.
2
 
@JerryCoffin I'm sure
 
Xeo
0
Q: How can we benefit from vs2010 hash_map's less?

ChangSee this if you don't know vs2010 actually requires total ordering, and hence it require a user defined less. one of answer said it is possible for binary search, but I don't think so, this because The hash function should be uniform, and it is better that load factor less than 1, it means, in...

Anybody got an idea what he wants?
 
2:06 PM
@Xeo a slap?
 
Any Unix guys in here?
 
Xeo
Many here have *nix knowledge atleast.
Anyways, off to get my hair cut. ;_;
 
I would like to add a lot of input parameters to a program using an alias, and I would very much like to add each parameter on a new line and preferably a comment behind it. How do you do this?
Right now I have :
hotspot -XX:CICompilerCount=1 -XX:+PrintCompilation -XX:+PrintInlining -XX:PrintIdealGraphLevel=1 -XX:PrintIdealGraphFile="file.xml" -XX:+PrintIdeal'
But would like to have it more:
hotspot
-XX:CICompilerCount=1
-XX:+PrintCompilation
-XX:+PrintInlining
-XX:PrintIdealGraphLevel=1
-XX:PrintIdealGraphFile="file.xml"
-XX:+PrintIdeal'
 
@Potatoswatter hype ;)
 
@ManofOneWay Try a continuation line with '\'. '#' is for comments.
foo bar baz \
      qux blag # magicks
Everything after the '#' is a comment though.
 
2:18 PM
oh for pete's sake... toString is a common thing in Java, why would you go an do "" + var rather then var.toString especially when in this case 'var' is a built in type for Java
@ManofOneWay I must ask, why?
 
You can do Integer.toString(var) if it's an int. There are equivalent methods for the other primitive types in the respective boxed classes.
@thecoshman Because primitive types are second-class in Java.
 
user784668
@R.MartinhoFernandes They're fourth-class. Classes are third-class, nothing is second- or first-class in Java.
 
sbi
Hey robot, check your mails!
 
@sbi what about his females? (lame pun-coon strikes again)
 
sbi
@thecoshman Nails! I was asking him to check his nails, of course! Sorry for the misspelling.
 
2:21 PM
oh wow, the SE patent thing sounds interesting
 
sbi
@Nick_Craver As it is, *fixing* the patent system would be to just shut the damn thing down entirely.
 
@sbi I was thinking of use that, but why would a robot have nails
 
@LucDanton Hm.. I actually have it as an alias, so I also have alias x='hotspot -XX:C...' How will I handle the '' ?
@thecoshman Why what?
 
sbi
@thecoshman Only 18th century wooden robots would have been hammered together with nails.
 
@ManofOneWay You can comment after the \ I think
 
2:24 PM
@sbi I assume that you mean that only regarding software/design/... patents, but not real ones, right?
 
@sbi ah, didn't think of that
@ManofOneWay well, they could have something that looks like nails. Or, I suppose, real nails attached in some way, but that would be starting to get a bit creapy
 
@LucDanton Sure, but I mean the everything has to in between ' and '
alias xx='hotspot -XX:Com....'
 
@sbi maybe, but that aint gonna happen, and this looks like an interesting compromise between the ideal solution, and the solutions that are practically viable
 
I don't like the idea of robots attempting to mimic humans, I want them look all machine-y and powerfull
 
@ManofOneWay You can try double quotes.
 
2:26 PM
@LucDanton 'try' huh
 
What am I, the man page for bash?
 
@LucDanton Is that a haiku?
 
user784668
@LucDanton lucdanton bash
 
@LucDanton more like the abridged version of the man page for bash
@StackedCrooked nearly
 
@Potatoswatter And you lived to tell us!
 
2:29 PM
@sbi Oh man, you're being much more helpful than I expected. Wait, that sounds wrong. That's not at all what I meant. Not that I expected you to be unhelpful, but, well, you're doing stuff I wouldn't even think of asking you to. Not that I want you to stop being this helpful either :) Thanks.
 
@LucDanton Double quotes around what? Could you show an example?
 
@LucDanton you're definitely a C++ man page.
 
@ManofOneWay Busy sorry
 
@LucDanton Np, thanks anyway :)
 
Xeo
@R.MartinhoFernandes Robot has some short circuitings it seems. :)
 
2:38 PM
greetings
How is everybody doing?
Oh that's good! Me? Yeah, doing well thanks.
:-)
 
@Potatoswatter Hmm...I have three brothers and two sisters.
 
what exactly is your problem, besides the fact that you procrastinated on your homework? — TJD 1 min ago
 
@Chimera Howdy.
 
@R.MartinhoFernandes greetings
@JerryCoffin I have two brothers and two sisters
 
I only have one brother, but I have thirteen uncles and aunts.
 
Xeo
2:46 PM
I have two little brothers, one of which I want to kill.
 
@Xeo Oh no! How do you plan to do it?
 
@Xeo So you have a little brother and a big bother?
 
Xeo
I don't know yet.
 
I'd go with the cement shoes and a large deep body of water.
 
Xeo
@StackedCrooked No, two little brothers, as I said. One is just more little than the other :P
 
2:48 PM
@Chimera There's an anime where they do that to someone who is immortal. So he keeps drowning again and again..
 
@Xeo Right, but the littlest brother is a big bother to you, it seems.
 
Xeo
@R.MartinhoFernandes Wut?
Ah
ahhhh
I misread it it as "big brother", not "bother"
@R.MartinhoFernandes And no, it isn't the littlest one.
 
@R.MartinhoFernandes Dat pun.
Good morning to everyone, by the way.
 
Xeo
That one's cool, except that I have to babysit him sometimes.
Morning
 
@tweetsbi The last time she came in my office, I simply explained that dust is a protective coating for furniture. She hasn't been in since.
 
2:52 PM
@StackedCrooked baccano?
 
@EtiennedeMartel Good morning
 
@yurikilochek Yep :D
 

« first day (705 days earlier)      last day (4226 days later) »