« first day (641 days earlier)      last day (4299 days later) » 

11:01 AM
What I ended up with in C++03
class MyClass {
struct PrivatePointers { int *i; } p;
public:
MyClass(): p()
{ assert(p.i ==0) }
};
 
this c++11/c++03 thingie when answering questions is starting to get on my nerves.. people writing answers only relevant to c++03 when a post is tagged with c++11 is just fucked up.
 
@ScottW we have several
 
@refp there is a downvote button for such things
 
am I the only one with this concern? I mean, questions that are answered with just c++03 (when we have the option to also mention c++11) will be quite pointless in a relative short period of time
@bamboon and I'm using it
 
@refp No, they won't.
@refp Where is that?
 
11:03 AM
@R.MartinhoFernandes oh sorry, I wrote that wrong.. I mean "tagged with just c++", and I stand my ground - I still consider it to be bad practice
when you say that "in C++ you cannot do this and that", well yes you can.. C++11 is C++
 
say...I can't seem to boot or install any sort of linux on any of my computers without the "noapic" kernel boot option..I was pretty sure intel had APIC though, what the hell?
 
Seriously, just edit those two digits into the answer.
There's no need to get all worked up. And no, that edit won't make it pointless. There will still be people using GCC 4.3 and VS 2008 for quite some time. And no, upgrading to C++11 is not effortless because there are breaking changes.
 
@R.MartinhoFernandes I updated the answer, but I still consider an answer written at this time only mentioning things relevant to c++03 is bad practice.. I might have expressed myself a little harsh, I'm not that worked up.
 
What? People should learn C++11 before they're allowed to help other people that don't need C++11?
That's not rational.
 
@R.MartinhoFernandes no, that's not what I'm saying.. I'm saying that people should know about c++11 when answering questions, stating that the information is applicable to c++03 but the context might have changed
 
11:10 AM
@refp Maybe your universe works in a different way, but in mine, you need to learn about stuff before you know it.
 
imagine me answering a post today with things relevant to c++98, imagine how many down votes that would get and how people would be quite annoyed because the information isn't "correct"
 
@refp No, it wouldn't. Because C++03 is pretty much the same as C++98.
 
@R.MartinhoFernandes to know about something isn't the same thing as knowing something from the inside out
 
There's only two pieces of information that you could get wrong in the whole standard.
 
@refp go all the way, write C89 answers instead :)
 
11:12 AM
@refp So what? They can know about everything else in the standard except the specific bit relevant to this question.
You're trying to artificially limit the pool of answerers for god knows what reason.
Also, do you know how many people develop using VC++?
Do you know how much C++11 does VC++ support?
As much as I'd like it to be otherwise, in practice C++ isn't C++11 yet. And it won't be for quite some time.
 
user457812
Well, the Android room is on its little C++-sucks-praise-Java high right now for some reason. O_o
 
Meh, we do C++-sucks-and-Java-sucks every day.
 
@R.MartinhoFernandes no, I'm not. and speaking of c++98 vs c++03, what I should start writing answers stating that std::vector<int> v (2,2); int* p = v.data (); *++p; is UB? I know there aren't many changes between c++98 and c++03, it was a silly example - I'll admit that
 
user457812
The weird thing is that they go back and forth on Java.
 
user457812
One day Java sucks, the next day it's god, and repeat. It's disconcerting.
 
11:16 AM
@refp No, because C++98 answers are practically irrelevant as no one uses any compiler that doesn't support C++03.
 
What happened to we never ever talk about java ever :p
 
@R.MartinhoFernandes ... we will never find an agreement on this
 
Now there isn't even one single compiler that supports all of C++11 and you already want to exclude people because they still don't know all about it.
 
user457812
@melak47 Bashing isn't quite talking. It's more primitive, more loving.
 
11:17 AM
Should forward that to my .net dev friends :P
 
user457812
It's like it comes from the heart.
 
And there is one major compiler that supports very little of C++11 around.
 
user457812
Clang? Scratch that, probably not major.
 
"Programming with .NET is like cooking in a McDonalds kitchen"
 
11:19 AM
And no, VS2012 doesn't improve much.
 
user457812
Hm, and I thought Microsoft was all gung-ho about C++11 support.
 
So, at least until 2014, a large population of C++ programmers will be stuck with a "C++03 + some stuff" compiler.
@nil Given that clang is the official compiler on Mac, I think it can be considered major.
 
user457812
Maybe. It's a semantics thing and unimportant, though.
 
Big G also uses clang IIRC
But the whole McDo kitchen story holds true for most of the .net people. Take their Windows, VS and whatever they use away and they can't do anything.
so I really have to work now :P
cu
 
user457812
Well, they could if they took the time to, but most would complain that they don't have an IDE.
 
11:25 AM
0
A: Can someone please explain move semantics to me?

FredOverflowMy first answer was an extremely simplified introduction to move semantics, and many details were left out on purpose to keep it simple. However, there is a lot more to move semantics, and I thought it was time for a second answer to fill the gaps. The first answer is already quite old, and it di...

^ Please post errors and suggestions in the comments, I will collect and incorporate them later.
 
It sucks.
It doesn't link to my comic.
:(
2
Q: Display rand() + rand() in cout in c++

user1534524Im desiging a maths quiz as practice of C++ as im a beginner. I've assigned random numbers using the following code: int random_integer = rand(); int random_integer2 = rand(); my problem is that i can't get cout to display what the results of the random number will be (which is basically my eq...

Seriously. WTF.
 
hehehe
 
How can I express this idea:
The first run of a loop.
for (int k=0; k<n; k++)
{
 
}
 
somelabel: foobar();
 
11:37 AM
@melak47 hehe
 
I want to prove something about the loop invariant
 
sorry
 
I don't know how to describe it.
 
@FrankScience k = 0 => whatever is true on the first run.
 
@R.MartinhoFernandes That's only my example.
 
11:39 AM
For a general case, split the loop in two parts.
"while(x) f()" becomes "if(x) f() while(x) f()".
 
My loop contains goto statement.
 
Oh. Out of my league.
Can't you transform the goto into another, more amenable, construct?
Dijkstra's famous paper describes several such transformations.
 
I don't want to know how to prove. I want to know how to describe my proof idiomatically.
Did you read Knuth's paper about goto statement?
 
@R.MartinhoFernandes your comic is bad and you should feel bad
 
@FrankScience Oh well, then I'll leave it to others to help if they can and want.
@thecoshman It's awesome.
 
11:43 AM
lol, I was confused who this random fucker was that was on my gmail contacts list, then remembered it's @DeadMG
 
You're obviously wrong.
 
@thecoshman You make it sound as if they're mutually exclusive.
 
@R.MartinhoFernandes /\./ly bad/
@DeadMG they are, you are just a fucker :P
 
lol
 
how goes the job hunting?
 
11:45 AM
kinda flump
 
you just got lazy didn't you
 
C:\>If you're happy and you know it, syntax error.
Syntax error.
 
@Neil :/
I think my computer might be depressed.
 
@Neil you should be ashamed of your self
 
@melak47 That's hilarious. What operating system is that?
 
11:53 AM
win7 x64
 
They must have changed it then I suppose
 
I guess the MS programmers are depressed then :p
can't blame them really :)
 
I guess "Syntax error" was finally ruled to be an unhelpful and vague response to a command
It only took them, what.. 15 years?
I don't know how to react to this. This is weird
My wife tells me they used a helicopter to deliver the couch we ordered today
they put a van with the couch inside on the roof and they brought it down the stairs
I'm pretty sure we didn't pay that much for delivery
 
pics or it didn't happen
that's more like it
 
I don't know if I believe it myself
 
12:23 PM
Uh, Blogspot added this at the end of code </int></int></typename></string></sstream></fstream></iostream>
 
@VinayakGarg It has forseen the end of everything with its mysterious endtags.
 
How do I fix it? Fix blogspot
 
I'm not familiar with blogspot, but it sounds like a template
If the template is wrong, you're screwed, my sincerest sympathies
 
Don't use Blogspot, problem solved.
 
Right
Any explanation for this
template <typename T>
gets changed to
template <typename t="">
oh it thought T was some tag attribute :(
 
12:29 PM
It treats it like HTML.
 
doesn't blogspot have some kind of markup for indicating code blocks?
otherwise, it's pretty incredibly broken
 
Use entities.
It's Blogspot, of course it's broken.
 
@CatPlusPlus there are different degrees of brokenness though
 
Hosted blogs are always broken.
 
But not always so broken that you don't have a way to type in verbatim code snippets
 
12:31 PM
But there are quite nice blogs on it
oh i guess its the content
 
@CatPlusPlus blog has to be hosted some where
 
on the moon
 
moon pie!
 
is it costly?
 
mmm, pie
@VinayakGarg what is?
 
12:33 PM
'moon' not 'mmm,'
 
hosting on the moon
 
why would it be? the moon is only just up there, and it's really close to lots of people
 
especially to those people on the horizon
 
oh yeah, they have the biggersest bandwidth evors!
 
12:47 PM
Can you have a long short?
 
oh joy, 2 hours of meetings ¬_¬
@Neil an int?
 
1:10 PM
@thecoshman you can have a long int and a long long, but you can't have a long short?
 
@Neil really, why do you want those constructs in the first place? In most cases you are probably better of with the (u)intN_t variants or an aribtrary-precision library.
 
Too lazy to test it myself: A a; a = A(someParams); triggers copy elision if A has no copy constructor?
 
1:27 PM
Yes, but also if A has a copy constructor.
If A really has no copy constructor (i.e. noncopyable) then the code won't compile.
 
Depends on operator=.
 
Right.
 
Hi there, i would like to ask, how can i do so when i push a button, sound starts playing and the message box to show instantly? i did it but when i push the button, it waits to end the sound, then to show up the message box. any help will be greatly appreciated.
 
You shouldn't push that button.
 
are you kidding me?
it's for a task...
 
1:31 PM
Is the button red?
 
black humour.
not funny
 
Not black, red.
If the button is black, you should check your gamma settings.
 
@ddacot You see that "code of conduct" on the right? Please read it, especially the very first statement in it.
 
@ddacot Make it so that your system is always playing sounds.
 
1:34 PM
Never push buttons from strangers.
 
Then you only need to implement the message box.
@ddacot Or you could use std::async.
 
@StackedCrooked What.
As in, no operator= ?
 
It's complicated.
 
In C++, what isn't.
I'll try to put it in a simpler way
I have a long lived storage a of type A. From time to time, I reconstruct the object using the same storage. a = A(lolol);
Can I reasonably expect the compiler to copy elide this?
 
Show us the class definition and we'll know.
 
1:41 PM
i asked seriously, i made a button, and when i push it, it must do 2 things at a time, but it finishes the first, then starts the second task.
 
Oh the buttonity.
 
class Block
{
/* Fields removed */

inline __device__ Block(GpuChromosome const& chromosome, int offset, int size);

/* No method no nothing */
};
 
@ddacot it's a myth that buttons are incapable of multitasking.
 
@ddacot Language?
 
Maybe the buttons are on strike.
 
1:44 PM
> use cin.getline with buffer or what Cicida suggests above
._. Cicida
 
Xeo
´@refp: Looking good, upvoted. :)
 
@Cicada c++
@ecatmur that's bad..
 
You realize all method calls are sequential and blocking unless otherwise specified
 
I prefer my buttons in ancient Sumerian.
2
 
@Xeo great!
 
1:46 PM
@Cicada I don't really see where any extra copy would come up. You still need to construct the temporary and then assign all data members.
 
Xeo
What I meant with the conditional operator was that there can be non-constant expressions in the unevaluated operand of ?:, && etc
 
So it is going to construct a temporary instead of reusing the old storage directly?
 
Xeo
That's what your earlier standard quote said
 
It cannot assign from nothing.
 
Hm, I expected some optimization to kick in.
 
1:48 PM
You could use move semantics, or something like a.swap(A(...)).
 
Reusing storage per-se is placement new.
@StackedCrooked It still involves a temporary. Copy elission eliminates unnecessary copies, but you cannot operate on air.
 
But it's ugly.
With placement new I have:
 
Then wrap it into a pretty looking function.
 
new (&context->blocks[blockId]) Block(context->chromosomes[i], offset, size);
This doesn't look like an assignation ;_; (because it's not, I know, but still).
Maybe I'm just being picky.
 
template <typename T, typename As...>
void reconstruct(T& thingy, As&&... args) {
    thingy.~T();
    new (&thingy) T(std::forward<As>(args)...);
}
Or something like that.
 
1:51 PM
You can wrap it so it looks like replace(old_block, args...);
 
You even get type deduction, so it's better for DRY.
 
@CatPlusPlus gotta be nothrow though
otherwise, bam!
 
Not really.
 
Or you can try to be fancy and make something that allows this syntax: reconstruct(block)(args...);
 
@MooingDuck Would your code handle \r\n?
Also: Hey everyone that is presently here.
 
1:53 PM
Everyone's not here ATM.
@StackedCrooked Meh, waste of time.
 
@CatPlusPlus Or taste of wine.
 
Hm. Guess I'll have to go with that. Thanks a bunch.
 
@KillianDS No, not really. I was merely curious if you could do that.
 
short is already a modifier to int.
 
I don't get why we have int and not integer but unsigned int and not uint.
"Let's have short names, but not everywhere."
 

« first day (641 days earlier)      last day (4299 days later) »