« first day (616 days earlier)      last day (4350 days later) » 

3:00 PM
@danuker That's the only purpose of having types at all.
 
That's not the only purpose.
 
@StackedCrooked Could you please give an example?
 
Singletons :D
No.
 
@danuker Move semantics ensure correctness of many types like unique_ptr.
 
wow, all the things i didn't learn yet
 
3:06 PM
Welcome to C++ ;)
 
A very common situation is that you have a virtual base class with a number of derived objects. You can't just copy the base object using value semantics because that would result in slicing. Copy could be implemented with a clone method, but usually I don't bother and make the object non-copyable.
Scoped locks and scoped resources also non-copyable.
 
coool
 
y u star everything
 
i just finished first year, it's very interesting!
oh
i thought the stars were just for me
 
no
 
3:09 PM
sorry
 
You should feel bad.
 
Ell
aww leave him alone ;)
 
@RMartinhoFernandes Why does this sounds like "Welcome to Hell"?
 
your starring's bad and you should feel bad
 
heheh
 
3:10 PM
@EtiennedeMartel There's a slight resemblance to a trident in those ++ signs.
But it's missing a dent.
 
i'm gonna post this room on my cs department's fb group
 
For some reason the majority of people don't feel inclined to visit a C++ chat room.
 
@danuker LOL
 
@danuker Oh fuuuuck. We're gonna get swamped by the nubcakes.
And it's not exactly a C++ room. It's more like a room that also features, sometimes, if the planets are aligned correctly, C++.
 
oh, I just remembered they can't chat unless they have 20 rep, haha
 
3:17 PM
Good for us.
 
@danuker So if I give you one downvote then you can't enter this room anymore :D
 
So, we're two upvotes away from being swamped by the nubcakes.
 
@StackedCrooked Noooooo
 
Dance!
 
my only weakness
 
3:18 PM
:p
 
@danuker Really? I'd have put that at your low intelligence, poor appearance, and lack of social skills :P
 
It's a combo pack.
It was in promotion.
 
haha
 
@danuker Just kidding :)
 
@DeadMG Looks like the pot is calling the kettle back.
 
3:20 PM
lol
 
Ell
grrr
didn't mean to post that horse picture haha
 
who the fuck is skrillex and why do I care?
 
It's mean.
 
3:26 PM
4chan is mean
 
I wasn't really posting it to you individually.
 
right
 
Ell
skrillex is a dubstep artist/person/thing/not entirely sure. But its to do with dubstep
YAAAAAAAAYYYYY serialization works!
finalmente!
 
@Ell So what have you serialized?
 
@Ell is it an elephant, to push it through a needle?
 
3:34 PM
I don't think I'd use boost serialisation again - protobuffers looks so tempting
 
Be careful when using boost serialization for communication. The boost serialization archive format is not forward compatible.
 
what's a jave
 
An old version of your program won't be able to communicate with a build that uses a more recent version of boost. (If the version number of the serialization library has been incremented.)
@CheersandhthAlf It's exactly what you think it is.
 
@CheersandhthAlf I took it to be a Java-Rave, no idea if that's right or not
 
@Flexo It is. All it needs to be perfect is a C++ generator that doesn't generate code as ugly as it does.
@Flexo That's the idea, yeah.
 
3:40 PM
@RMartinhoFernandes Yeah, as long as you don't look at the code, it's alright... but auto complete pretty much gives it away.
 
@JohannesSchaublitb Pattern matching can do that, too, but better.
 
@StackedCrooked Protobufs have proper versioning facilities built-in from the start.
 
Ell
@StackedCrooked I have serialized... erm. Well its really nothing. An empty class.
 
@RMartinhoFernandes Yep.
 
3:41 PM
^ It's the song "Shift & Jave - Fått 'An" by "Konstante Trusler". It's about a woman who "got it" ** both ******s.
 
^ If anyone wants to try Google translate on the lyrics. ;-)
 
11 hours ago, by R. Martinho Fernandes
-1
Q: Convert Java to C++

Fourthmeal70I have this jave code that sorts an array. First it sorts the Even numbers and then the odd numbers and at teh end combines the arrays to print one sorted array with Even numbers first, odd numbers last. Now I've written some sorts in C++ but I'd like to get an understanding on good ways to conve...

That's the source.
 
oh
not the song?
 
Ell
@RMartinhoFernandes ikr?
 
3:43 PM
It's like a rave... but with Java.
You definitely don't want to be in one.
 
It's a cult among Java programmers.
 
mixing Java and raves?
that's like trying to mix Stalin and Hitler
 
They probably all listen to Skrillex.
 
Shitin taller
 
3:57 PM
could anyone explain please exactly what is dub-step?
 
could anyone explain what 'shitin taller' is
 
@CheersandhthAlf Like drum&bass, but with way more bass.
 
much more bass, ok
 
If you ever heard a song that sounded WUBWUBWUB, that's it.
 
Cheers and hth alf, Hi, did you mean to discuss this here? :)
 
3:58 PM
Btw, does anyone know what happened to @Xeo? Haven't seen him online in a while.
 
@NikoDrašković yes. i don't understand how you get the results you do. i get different...
 
@StackedCrooked 17 days, in fact
 
Well, first off I'm really a beginner in c++ so bear with me
 
[d:\dev\test]
> (cl /nologo- 2>&1) | find "++"
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.40219.01 fo

[d:\dev\test]
> cl /O2 /D _CRT_SECURE_NO_WARNINGS foo.cpp doNothing.cpp
foo.cpp
doNothing.cpp
Generating Code...

[d:\dev\test]
> foo & echo. & foo & echo. & foo
C strings: 0.355 seconds.
C++ strings: 0.159 seconds.

C strings: 0.374 seconds.
C++ strings: 0.165 seconds.

C strings: 0.387 seconds.
C++ strings: 0.169 seconds.

[d:\dev\test]
> _
 
@NikoDrašković bear reporting for duty :)
 
4:00 PM
hh
 
He's probably doing cooler stuff than C++.
 
well, the results I'm getting are completely different
 
Or dead.
Ok, that came out wrong.
 
and the code is the same, i just copy pasted it and compiled. Have you tried to test for equality in the ifs?
 
How would it come out nicer?
He's posted comments on the main site, including yesterday.
 
4:01 PM
As in more like the city of Nice?
 
if i put the doNothing function in the file the results are roughly the same:
[d:\dev\test]
> cl /O2 /D _CRT_SECURE_NO_WARNINGS foo.cpp
foo.cpp

[d:\dev\test]
> foo & echo. & foo & echo. & foo
C strings: 0.33 seconds.
C++ strings: 0.143 seconds.

C strings: 0.359 seconds.
C++ strings: 0.162 seconds.

C strings: 0.379 seconds.
C++ strings: 0.158 seconds.

[d:\dev\test]
> _
 
Can only assume @Xeo is constantly on IRC for Kyrostat
 
so, could you put the code you compiled, on PasteBin?
 
Ell
pastie is much cleaner imho
 
@StackedCrooked Obviously
@Ell ideone.com FTW
 
4:03 PM
or "pastie" or "ideone"?
 
Yeah, I should stop making such unnecessary comments :)
 
Could you try using the doNothing function (change the ifs so that it is actually called)
 
@CheersandhthAlf Is this about desserts?
 
@StackedCrooked probably me too
 
@danuker Let's form a club.
The inanity spouters. Or something.
 
4:04 PM
2
A: C-Style strings versus library string performance

Cheers and hth. - AlfYour conclusion that C style strings are faster with this example with your compiler & machine, is almost certainly because – one must presume – you forgot to turn on optimization, forgot to make the string length "unknown" to the compiler (this is tricky) so as to prevent it f...

 
@StackedCrooked Deal
 
^ See the discussion under my answer.
 
I see.
 
Might be related to this? stackoverflow.com/questions/9371238/… Nope, I'm an idiot.
 
The boost con talk by Sean Parent was quite interesting.
Too bad about the inferior audio quality.
 
4:07 PM
@StackedCrooked blasphemist union
@StackedCrooked Pulled a boost "con" - what was the subject?
 
my favorite thing in the world right now reddit.com/r/programming/comments/vg0cn/…
 
"Now What? A vignette in three parts"?
 
@sehe About shortcomings of C++ in the current revolution of vectorization. And ideas for the future.
 
> Part 2: Truth - On modern hardware, straight C++ code gives you access to just 0.25% of the available performance on the machine. With C++11 we unlock only a little more with thread support. One of the largest challenges for the language and libraries going forward will be how to get at the other 99.75% of the machine.
 
It sounds crazy but it becomes clear in his talk that he does have a point.
 
4:10 PM
@sehe where you quoting that from?
 
It doesn't sound all that crazy
 
If you have a powerful graphics card in your computer than C++ doesn't provide you with the means to make use of it.
 
@StackedCrooked Not vanilla, at least
@StackedCrooked Anyways, my solution for that is to use crappy onboard graphics
 
Btw, Sean Parent directly answered one of my SO questions :)
His previous talk from a few years ago was also quite interesting.
 
But, he has 0 rep - oh wait, in the last week :)
 
4:12 PM
Cheers, apparently I was doing something wrong, because now I seem to be getting the same results as you...
So your answer it is then...
 
@sehe Answering my question is the only thing he's ever done on SO :D
 
@StackedCrooked How can we explain this, though:
2
A: Adobe Adam and Eve (C++ ASL): how to bind Eve variable so to get it updated inside C++ application?

Sean ParentA good place to ask questions about ASL is on the ASL developer mailing list: http://sourceforge.net/mail/?group_id=132417. You might want to look at the "Begin" test app . Although this only runs Mac and Win it does demonstrate how to wire things up. The basic idea is that when a layout descri...

 
Ah. It appears that I've been talking out of my ass again.
 
It appears Sean Parent is creating accounts out of his ass :)
 
How did you find that second profile?
 
4:15 PM
[d:\dev\test]
> cl /O2 /D _CRT_SECURE_NO_WARNINGS foo.cpp
foo.cpp

[d:\dev\test]
> foo & echo. & foo & echo. & foo
C strings: 0.364 seconds.
C++ strings: 0.16 seconds.
doNothing was called = true.

C strings: 0.414 seconds.
C++ strings: 0.192 seconds.
doNothing was called = true.

C strings: 0.41 seconds.
C++ strings: 0.173 seconds.
doNothing was called = true.

[d:\dev\test]
>
 
@StackedCrooked Search...: stackoverflow.com/users
 
You found it with search. Makes sense.
 
I usually try to make sense
 
4:18 PM
@CheersandhthAlf How is this supposed to be used?
    string str( argc == 10000? argv0 : "a very long literal string" );
Seems to suggest we need to pass exactly 9999 commandline parameters !??
 
@sehe it's a device to foil the compiler's optimization
 
Ok, so no need for a parameter then
 
Charlatanry!
 
no
@NikoDrašković see above results
 
@CheersandhthAlf Ok, with -O0 and the loop changed to 1ul<<22 iterations:
C strings: 0.27 seconds.
C++ strings: 0.41 seconds.
doNothing was called = true.

real	0m0.691s
user	0m0.692s
sys	0m0.000s
 
4:22 PM
@sehe You should try pinging one of his recent active accounts to see if he wants them merged.
 
With -O3:
C strings: 0.25 seconds.
C++ strings: 0.29 seconds.
doNothing was called = true.

real	0m0.549s
user	0m0.548s
sys	0m0.000s
@CheersandhthAlf what compiler have you used on windows? Clang, gcc or msvc?
Nm. cl -> msvc
 
anyone know haskell?
 
with g++ i get the surprising result you do
 
@AgainstASicilian lol
 
however, @NikoDrašković is using msvc
 
4:24 PM
@CheersandhthAlf Clang 3.1 is better, with -O3:
sehe@mint12:/tmp$ time ./test
C strings: 0.22 seconds.
C++ strings: 0.3 seconds.
doNothing was called = true.

real	0m0.524s
user	0m0.520s
sys	0m0.000s
@CheersandhthAlf I'm too lazy to fire up a windows VM. Besides, you already did that particular bench
afk - cooking
 
[d:\dev\test]
> foo & echo. & a
C strings: 0.354 seconds.
C++ strings: 0.16 seconds.
doNothing was called = true.

C strings: 0.41 seconds.
C++ strings: 0.51 seconds.
doNothing was called = true.

[d:\dev\test]
>
the first is msvc, the second is g++, both with O2
i think we can say that g++ is doing a lousy optimization job, and/or has a lousy std::string implementation (and also, C string implementation!)
 
Well, that is also odd...
 
man
I purchased 6 litres of coke two days ago, and I'm down to 1
 
@DeadMG jeez, how's your nose?
 
by the way, are you on Windows, @CheersandhthAlf?
 
4:30 PM
@NikoDrašković yes.
 
So when you use g++, you use mingw or?
 
user784668
fill_n y u return void
 
By the way, how do you copy your output so nicely? So I don't have to retype here?
 
@Fanael What else would it return?
 
user784668
4:38 PM
@FredOverflow OutIt
 
@CheersandhthAlf when I use that exact code on Ubuntu, with GCC, I get:
C string 0.06sec, c++ string 0.08sec
 
user784668
@FredOverflow Oh, it does return OutIt in C++11.
 
So this is kind of 5 times faster than the same code on Windows...
 
@NikoDrašković you can configure console windows to do this more easily, but if you haven't configured, it's like this: right click title bar of window or click window menu icon, then choose [edit -> mark...], then drag thorugh rectangle, then right click to copy to clipboard. or -- just install Console replacement. :-)
 
@FredOverflow "pattern matching" ?
 
4:40 PM
the window menu is also available via [Alt Space] in all Windows programs except Microsoft's latest programs, and maybe even in those (I checked now)
 
hukl@ubuntu:~/Documents/CppPrimer$ g++ -O3 a.cpp
hukl@ubuntu:~/Documents/CppPrimer$ ./a.out
C strings: 0.06 seconds.
C++ strings: 0.07 seconds.
doNothing was called = true.
hukl@ubuntu:~/Documents/CppPrimer$ ./a.out
C strings: 0.06 seconds.
C++ strings: 0.08 seconds.
doNothing was called = true.
Tnx for the tip ;)
 
do you mean like switch(var) { case pattern("x"): ..; case pattern(number(x)): .. } ?
 
@JohannesSchaublitb Are you serious, you have never heard of pattern matching?
 
no not in this context
 
By the way @CheersandhthAlf ,thanks for all the help (I'm saying this now in case I have to run if my boss comes ;) )
 
4:43 PM
surely in context of regular expressions and haskell's "head (x:xs) = " thing
 
well i would have liked to check also in ubuntu but i can't remember the mount command details
so
:-)
 
@CheersandhthAlf My tests were on Ubuntu.
 
@JohannesSchaublitb In Scala, I always think of Pattern Matching as a switch on steroids :)
 
sbi
@KonradRudolph I never have less than a 3 digit number of tabs open — currently in eight open Windows. /cc @Cat
 
@CheersandhthAlf BTW, -ltcmalloc (google perf lib) increases performance by quite a bit
 
4:44 PM
@FredOverflow so how to switch on types with pattern matching?
say we have a string, tuple, array and int type
 
@sbi That’s just insanity ;)
3
 
Still cooking - and a headache, so I can't whip up all the numbers quickly
 
So is it that the MinGW is 5-10 times slower (optimization wise) than GCC?
 
@KonradRudolph precisely. Use services like "read later" for all other 'shit' - you can't possibly actively use so many tabs at the same time. There are plenty - way more effective - archival and indexing tools. Make searching them more effective too
@NikoDrašković "optimization wise"?
 
@FredOverflow I also didn't know about pattern matching until 10 months ago or so when it was discussed in this room.
 
4:47 PM
@sehe as in GCC is better at optimization than MinGW
 
def example(x: Any) = x match {
    case s: String => "It's a string!"
    case t: (Int, Int) => "It's a tuple!"
    case a: Array[String] => "It's an array of string!"
    case i: Int => "It's an int!"
}
 
based on the difference in the results we got using MinGW on Windows and GCC on Ubuntu with the same code
 
@JohannesSchaublitb Not sure if this can be generalized to arrays of any type though. Same goes for the tuple, I've edited it to be concrete.
 
or could it have been a Windows - Ubuntu reason for the performance difference?
 
@FredOverflow ah i like that much better
 
4:49 PM
@FredOverflow Oh wait, apparently it's only 6 months ago.
 
@FredOverflow You can write something like that in Wide, if you were to write the correct libraries.
 
@FredOverflow if one just had a switch on types, you would still need to cast to that type. your switch statement will do all in once
 
Right, you can use the variables right away after the => symbol.
 
Hmm, even books on Linux system programming claim that strlen is a pure function
 
@KonradRudolph It is.
 
4:51 PM
@DeadMG No, I just looked it up in the source
@DeadMG And it cannot be pure
Because you can modify the string (sequence of chars starting from some address) without modifying the input (the pointer to the address where the string starts), i.e., you can't memoize it. It would only be a pure function in a language with immutable strings (Java, say). — mob 21 hours ago
 
@JohannesSchaublitb That's especially handy in the implementation of equals:
def equals(x: AnyRef) = x match {
    case that: MyClass => this.member == that.member
    case _ => false
}
 
strlen is special-cased by the compiler because it’s a builtin, but it’s not pure
 
"Any" means "reference and value type" i guess?
 
@KonradRudolph Only if your only definition of mutation is binary, which is dumb.
 
@JohannesSchaublitb yes
 
4:52 PM
hmm
 
in my book, strptr[0] = 'x' sure counts as mutating
 
Value types will automatically boxed when the implementation requires it.
 
@DeadMG No, strlen would be broken if it were declared pure, it’s as simple as that
@DeadMG But the compiler cannot possibly test for that scratch that, it does
 
We need more purity in programming languages.
 
@KonradRudolph Strictly speaking, aliasing makes it undecidable.
 
4:53 PM
but it can only do that because strlen is a builtin
 
i found that implementing a GC slows down value type copying
 
but in reality, it would not be common
 
@JohannesSchaublitb Can you elaborate on that?
 
when you implement memory management with reference counting, value types are efficient because copying is not needed. but if you do it with a garbage collector, you can't anymore implement COW so you always need to copy the data
 
I still don't follow. Do you mean copying in the compacting phase of the collection?
By value types, do you mean C# structs or immutable reference types like C# string?
 
4:57 PM
@FredOverflow ah wait. the "switch(x) case y : Int: ..." means "if x is equal to y and is an int" right?
 
why can't you implement COW with a GC?
 
@FredOverflow no during normal run i mean
 
I'm pretty sure that COW with a GC is one of the primary reasons that many tree structures are very efficient in functional languages
 
if you have the reference counting, it automatically as a side effect counts the references to a string data
so when saying "a = b" you don' need to copy b right away because of COW
 
@JohannesSchaublitb No. It means if x is actually an Int, no matter which one, then introduce a new variable y and initialize it with x.
 
4:58 PM
@sehe "turbo cmalloc"? <g>
 
but with a garbage collector, if you want "a = b" to copy b, then you cannot apply COW since you have no way to count the references efficiently
so you have to copy right away
 
@JohannesSchaublitb Right, but you don't need to count the references, since it's going to be GCed.
 
@FredOverflow ah i see. if you leave off the ": Int", then it means "if x equals y" right?
@DeadMG i mean you need to count the references if you want to implement COW
 
@JohannesSchaublitb No, I don't think so. Pattern matching introduces new variables, it doesn't check existing ones.
 
@JohannesSchaublitb No you don't.
 

« first day (616 days earlier)      last day (4350 days later) »