« first day (639 days earlier)      last day (4308 days later) » 

7:00 AM
All pointing to QWidgets which I need to initialize with the concerning objects constructed from my ui file.
 
36
Q: What do the following phrases mean in C++: zero-, default- and value-initialization?

BillWhat do the following phrases mean in C++: zero-initialization, default-initialization, and value-initialization? What should a C++ developer know about them?

 
thx :)
Memset/memcpy are far more error prone than many old timers believe. PVS Studio pointed out several new errors from the last few months.
No more memset in my code!
:)
 
Well, getting late (for me). Gotta get some rest. G'night all.
 
7:26 AM
Does anyone here have some experience in Xcode being horrible with errors?
I'm getting "Invalid operands to binary expression" long after I've deleted a section of code that its relevant too
I deleted the entire file and I still get it, clean build, restart system, ect
 
@JerryCoffin Good night!
 
@TomasCokis Yes, Xcode is horrible with errors
 
@jalf any hints to getting it to work? I'm stuck with the build failed with everything I try
 
Nope, can't help you there. :)
 
Xeo
@TomasCokis Having the build fail even though you solved the error sounds like you edited the wrong file, rather than Xcode acting up.
 
7:32 AM
ah well, thanks anyway
@Xeo, I havn't solved the error as much as deleted the function and all references to it
the error remains and references a section of code that doesn't exist anymore
 
Xeo
Then you edited the wrong file
 
if I click it it pulls the file but highlights some comments near where it used to be
 
Xeo
Or you have the wrong file loaded.
 
Hmm, maybe
@Xeo I'm just using Xcode's internal file editor, do you know of any ways Xcode might be referencing a file but compiling a hidden copy?
 
Xeo
Sorry, I don't work with Xcode
however, deleting something and it still being there in any IDE practically screems you edited the wrong file
 
7:35 AM
@Xeo, Thanks anyway, I'll look into the filesystem a little
@Xeo, I guess, but when i select the error it pulls me to the file its in, which has been edited as I expected
 
morning
 
@Xeo Do you know anything about the error "Invalid operands to binary expression (const objectType and const sameObjecType)"?
 
Xeo
What binary expression?
 
@Xeo, that was the original problem
 
@TomasCokis show ( via www.ideone.com) us your code
 
7:37 AM
operator==
 
Xeo
Btw, no need to ping me with every message
 
Right, sorry
 
Xeo
@TomasCokis Is it a member?
Or free function?
 
I've deleted the function that was acting up already
 
stupid markdown
 
7:37 AM
Just a function in a namespace
 
Xeo
@thecoshman [show](http://...)
 
I can post the log
 
Xeo
@TomasCokis definition?
 
oh, links HAVE to be with 'http://' ¬_¬
 
Xeo
aye
 
7:38 AM
I can redo the function as well if that would help
 
Good mmorning
 
Xeo
That's what I meant with "definition?"
 
Yeah, I'll type it up again
 
Waiting for an open bridge on the highway. Droll...
 
Xeo
mornin' sehe
 
7:40 AM
@TomasCokis first error is saying there is no comparision operator for those two types. Are you having problems writing such operator, or is that you are getting this error, but don't see why it is including this file with this error?
 
Xeo
@thecoshman Your new avatar's reaaaally irritating me, the small version is so similar to @FredO's old avatar
 
The class in question is just a basic type
 
@Xeo whos?
 
Xeo
FredOverflow
 
@TomasCokis that makes no sense
 
7:41 AM
the overall problem is I've deleted the function but I still get the error and my build still fails
 
can't think what his old Avatar looks like
@FredOverflow any chance you have a link to your old avatar that (apparently) mine looks like
 
Happy Monday, everybody!
 
Xeo
@Neil I soooo want to bin that.
 
^ Now tell me honestly, don't you want to shoot me?
 
What's wrong with Monday?
 
7:44 AM
@TomasCokis well, the error is that you are missing the operator == for that pair of types. Some where you are calling that operator, are you saying that as far as you know, you are not making any calls to that operator?
 
Someone told me that this morning and I had to resist the urge to scream back, Happy Fuck You Day!
Must be the lack of coffee
 
@RMartinhoFernandes apparently, very little. People mostly just spend to long worrying about going back to work that don't take the time properly relax over the weekend
 
brb
 
thats the function
I used it with vectors of a type PSPlanet::Segment, which has an operator == statement of return1
 
and the error is saying that for whatevernamespaceitwas::whatevertypeitwas there is not '==' operator deffined
 
7:46 AM
1
Q: Generate random number in C++ at compile time?

pyCthonHi I'm trying to precompute random values using c++11's random library at compile time.I'm mostly following from examples. What am i doing wrong here ? using namespace std; #include <iostream> #include <vector> #include <random> vector<double> rands; ...

lol
 
Xeo
@TomasCokis if(vec1 == vec2) is provided by the stdlib. :P
 
@TomasCokis You could check if their sizes are not equal before entering loop
So you could return immediately false in the case
Would be quite the optimization actually
 
Oooh random downvotes you so silly ~
 
Xeo
Oh, we have a bug in the chat.
 
Yeah, I just rewrote it quickly
should probably do that, but thats not the problem
 
7:48 AM
This will hopefully be built into compilers once C++11 becomes more mainstream. People have already expressed desire for this feature: gcc.gnu.org/ml/libstdc++/2009-04/msg00116.html. Others have written libraries of contexpr functions, but all seem to leave out random numbers. It has been talked about as a possible item to include in the standard library: open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2994.htmMichael Graczyk 2 hours ago
 
Xeo
1 min ago, by Xeo
@TomasCokis if(vec1 == vec2) is provided by the stdlib. :P
 
WTF. Why would anyone want compile-time random numbers?
 
I encountered errors with a straight == and just decided I would rewrite it
 
@TomasCokis No harm done. Relax. Expect a phone call from the FBI shortly.
 
Xeo
@TomasCokis What errors?
 
7:48 AM
@RMartinhoFernandes TMP?
 
@TomasCokis by the way, not need for your third parameter and template U auto iterator = vector.begine() will automatically make iterator of the right type for you
 
@Cicada What for?
 
For TMP!!
 
I can't remember, but thats not the problem, I'm still getting errors from using this function after I've deleted it
 
@RMartinhoFernandes C++script!
 
7:49 AM
I don't know, meta models.
 
Xeo
Say, robot, isn't @thecoshman's grayscale avatar irritating you too?
 
Random meta models?
 
@thecosh, thats neat actually, cheers
 
Yep. So you can generate many replications of your model with different input params or something.
 
@RMartinhoFernandes your's is just as annoyingly grey scale... douche bag :P
 
7:49 AM
@Xeo It's been a looong time now since he changed.
@Cicada input params?
 
Xeo
Well, it just reminds me of FredO's old ava
and that irritates me
I always think he's writing
 
Yas. Input params.
 
TMP for computation is silly.
 
Initial state. Parameters. Whatever.
 
@Cicada So what.. you'd make a runtime compiler so that you could use types pulled from libraries or something?
 
7:50 AM
@TomasCokis you can't remember the errors you got, the code you showed doesn't match the code you're asking about, and the code you're asking about no longer exists.... Do you seriously expect anyone to be able to give you a useful answer to any of this? O.o
 
@Neil That already exists.
 
I honestly have no idea
 
@TomasCokis no, the problem is that for what ever you where using operator==(std::vector, std::vecotr) you where not getting the right result, either you are not using it correctly or there is a bug in the comparison operator
 
If you want to do computation, why not do it with an optimized binary instead?
 
@Cicada Then I fail to see the advantage here.
 
7:51 AM
Write your own code generator that does the computation. Zillions less arcane, zillions faster, debuggable.
 
@RMartinhoFernandes Well yes, precisely??
@Neil I'm just suggesting. Not advocating.
 
@Neil since when has that stopped TMW
 
My mouse is slowly dying. 1 click out of 8 fails. This is annoying.
Template Meta Wrogramming.
 
I simply assumed lazy programmers wouldn't create something with no benefit whatsoever
 
7:53 AM
@Cicada it's just entered self-preservation mode. Saves wear and tear when it only has to register 7 out of 8 clicks... ;)
so it'll last longer!
 
Though coolness is a factor... hmmm...
 
Xeo
@RMartinhoFernandes Template Meta Wanking.
 
@jalf It will probably last longer in the trash can.
 
I hate to say it, but the trend of languages lately has been towards script languages
 
Whatever that means.
 
7:54 AM
Unless it has to do things with incredible speeds, I think a script language is becoming the norm
 
No.
 
@Neil So that's why there are half a million apps on the iOS app store built with compiled languages? ;)
 
@Xeo close enough, wankery I was going for :P
 
@jalf It's being run on a device.. those have to run fast
 
@Neil 'scripting'?
 
7:55 AM
@Neil And so it doesn't count towards any "trend"?
 
@jalf Hey :) I emailed you yesterday, just so you know
 
@thecoshman "'scripting'"?
 
The trend 5 years ago was towards script languages. Because 5 years ago, the trend was towards making everything run on a webserver (except for the bits that should run in the browser. The trend today is a lot different, and certainly not uniformly "towards script languages"
 
So, you're saying that "script languages" (whatever that means), are becoming the norm on their own niche. Sounds surprising.
2
 
@jalf No, not uniformly. Speed is still very much an issue
 
7:56 AM
Speed is more an issue than it's been for the past 15 years
 
@jalf I would argue that speed has always been equally important, not more important
 
And compiled languages (again, whatever that means), are much more relevant than they were a few years ago
@Neil Then you'd argue wrong. ;)
 
@Neil 'scripting' is just a use for a programming language. There is not trait about the language it self that makes it a scripting language, it's just the most popular way to use such a language is in a silly interpreted / semi-compiled mode which allows you to start running code with out having to wait for a compilation process to complete. I could 'script' with C++, and I could compile JS, scripting is a buzz word, get some synergy
 
The technology has improved, but that's different
 
Because people expect more and more software to run on limited devices such as phones, and they expect it to be incredible responsive. That makes speed a big priority. A few years ago, people just expected a web page which loaded within 100ms or so, which means that scripting languages and slow code was ok
 
7:59 AM
@thecoshman Synergy isn't a buzzword?
 
And because (singlethreaded) processor speed is no longer increasing as fast as it used to. You used to be able to write slow code and trust that "the CPU will make up for it in a year or so anyway"
 
@jalf 15 years ago, you'd never have heard a programmer say that writing slow code was ok
 
@Neil But 7 years ago, you definitely would. :)
 
@RMartinhoFernandes 'Synergy' is an awesome program, 'synergy' is a buzz word... that a friend attempted to use in a genuine context yesterday, I shuddered
 
well, except that people rarely put it that way
 
8:00 AM
@jalf Writing efficient code was and always has been priority. Hardware increases speed as much as it can, because that's mostly what's important about it anyway
 
@Neil No, it has not always been a priority. Not out here in the real world
 
indeed, the code was not slow, it was just focused on a highly other factor that we can talk about to hide from the fact we wrote shitty code but hope that in a few years times hardware will hide the problem altogether
 
@jalf So you wrote slow code 7 years ago? I'm supposed to believe you didn't care about speed 7 years ago and that your boss said, "Meh.. not important. Hardware will make it better in a year or so anyway."?
 
Take a look at Vista vs Win7, if you will. Vista: "we can do what we like, and the CPU will run it". Win7: Oh shit, people want to run this on netbooks? We're going to need to optimize the shit out of this"
 
I'm sad because Win8 is going to suck.
 
8:02 AM
@Neil I didn't say *I wrote slow code. I said that 7 years ago there was less concern about efficiency. For many purposes, you could get away with doing more in relatively ineffient scripting languages
Or just with less efficient code
 
@Cicada It's an inverted Star Trek rule.
 
@Neil But I am absolutely saying that many people had bosses who said "meh, not important. Hardware will make it better in a year or so"
 
I think the focus has changed, yes. Things need to be faster to work on smart phones.. yet at no one point was speed not an important consideration
 
If that surprises you, then I don't know which planet you've lived on, but it's not this one
 
@RMartinhoFernandes go on...
 
8:03 AM
@thecoshman Odd-numbered Star Trek movies suck.
Even-numbered Windows releases suck.
Do the math.
 
@RMartinhoFernandes ah, that old nut cracker
 
@Neil Speed is always a consideration in the sense that code always, by definition, has to be "fast enough". But the meaning of "fast enough" has changed dramatically. Code that was "fast enough" then would be considered too slow for many purposes today
 
It's also sad that Google uses Java and not C#. Oh well.
 
@RMartinhoFernandes Which breaks down if you go back far enough. Remember how ME was followed by 2k, then XP then Vista? If you want Vista to be on the "bad" list, then ME ends up on the "good" list
 
@jalf I would never consider picking a slower sort algorithm because speed is "less" important
"fast enough" for a programmer has always been, "code to the best of your ability"
 
8:05 AM
@Neil Wow... no it hasn't
 
@Cicada AFAIK Google use all sorts of stuff, they understand there is no one language fits all
 
Have you ever actually had a programming job?
 
@Neil No, but you would stop optimizing when you consider your code to be fast enough. Not absolutely fastest possible.
 
I could spend weeks optimizing a small insignificant snippet of code "to the best of my ability". I'm pretty sure my boss would fire me if I did that
 
@thecoshman But C# fits more. And is faster than Java. And prettier. And overall better.
 
8:06 AM
Well by optimization, I mean at an algorithmic level, not cutting corners at a compiler level
 
@Neil no, code has to meet requirements first and foremost
 
@Neil So? The exact same thing is true there
 
@Cicada as far as code aesthetics code, comparing C# and Java is like comparing horse shit to cow shit. Either way, you don't want them in your face
 
Anyway, I was talking about performance overall, not specifically algorithmic complexity, but the runtime performance of code written to do a task
 
Horse shit is better.
 
8:08 AM
@Cicada It don't think C# is faster than Java either
 
Xamarin did some benchmarks.
 
@ManofOneWay my gut feeling is that it is faster
 
@Cicada as for speed... citation needed, of STFU
 
@jalf not listening
 
8:09 AM
I don't have data to back it up, but I've seen lots of snappy, responsive C# code. Java code always feels like the CPU has fallen asleep
 
There.
 
It's very hard to say, it all depends on how much effort you put into the JIT compilation
 
@Cicada unless there is a HUGE obvious winner, I'd imagine the slight winner is just because the code tested was slightly better for the one language
 
That's Dalvik, it's the Android VM
 
8:09 AM
Agreed, we're comparing VMs and not languages here.
 
@ManofOneWay Of course. There's nothing (well, not much) in C# the language spec that'd make it inherently better/faster than Java the language spec
 
You should compare it to the HotSpot VM
 
@jalf s/the CPU/everything/
You should not compare.
 
but seriously, does it matter? Language performance comparisons are pretty much useless in nearly all cases
 
No. C# is better.
 
8:11 AM
@ManofOneWay that doesn't list .NET's C# though. Shouldn't we compare against that too?
 
No.
 
Comparison => evil. Evil => bad. Bad => evil. Evil => bad. Bad => evil. Evil => bad. Bad => evil. Evil => ... wait. Something's gone horribly wrong in my reasoning process.
 
Well, Cicada used Mono in the first benchmark.
 
A Mono VM designed for Android devices.
 
8:13 AM
@RMartinhoFernandes break, robot, break! Break damn you! I won't let you get in an infinite loop!
 
@Cicada I could just make a VM that is AWESOME for those few test cases and prove that Java is the fastest
 
@ManofOneWay Yeah, but if you want to compare "the biggest, most serious" Java VM, then shouldn't you also pick your C# VM by the same criteria?
 
Anyway, it's all about implementation, so let's forget about it
 
@thecoshman Could you?
 
@jalf Sure of course
 
8:13 AM
@jalf You suck at this. Always pick the statistics that favour your viewpoint.
 
Hah. Yet another moveable bridge opens right before my nose at <300 meters of my destination
 
@thecoshman I'd make a VM that is AWESOME for the few test cases that cover 100% usage case.
 
You don't use Java for speed. Period.
 
@sehe It's open! You can cross now!
 
You don't use Java. Period.
 
Xeo
8:14 AM
@sehe Make a mad dash and jump over.
 
@RMartinhoFernandes I hypothetical me who is a damn site smarter and more determined, yes. I am sure the trade of would be that relatively trivial things suck ass
 
@Cicada I wouldn't touch C++ with a ten foot pole to do web programming
For some things, Java is best
2
 
Use PHP.
2
 
@Cicada you do if you want to keep your job for which you where hired as a Java developer
 
@Neil For web programming?
 
8:15 AM
Well, the thing with JIT compilation is that it could in some circumstance produce faster code than statically compiled code. Since you could collect a lot of runtime information, which in turn could enhance the register allocation when knowing which branches are more often taken.
 
Are you serious?
 
@RMartinhoFernandes Better than C++. You want to argue that?
 
Xeo
@Neil It's best at being bashed by us.
 
@Neil Oh. No.
 
@RMartinhoFernandes Ah okay, thx :P
 
8:16 AM
It must be summer holiday
 
@Xeo No, it's not. That's PHP.
 
Xeo
@RMartinhoFernandes PHP is best at having a language silly war with.
 
0
Q: Portable C binary serialization primitives

PotatoswatterAs far as I know, the C library provides no help in serializing numeric values into a byte stream. Correct me if I'm wrong. The most standard tool in use is htonl et al from POSIX. These functions have shortcomings: There is no 64-bit support. There is no floating-point support. There are no v...

 
@ManofOneWay The thing with JIT compilation is the "could", really. In theory it could be incredibly efficient. In practice, it typically isn't... ;)
 
bashing PHP is no fun. At least when we give digs at Java, it occupationally has has a few points it counter with
 
8:17 AM
@jalf It all depends on how well-crafted your benchmarks are.
 
@RMartinhoFernandes heh, true enough :)
 
@RMartinhoFernandes more about how useful your VM is, if your optimise it for a few bench marks, you might try to get away with a VM that sucks wen trying to allocate objects more complex then one int
 
Yep, you missed the point.
Also, C++ tends to suck at allocation when compared to C# or Java. Very bad example.
 
Always at a cost though
 
A proper string allocator can work wonders
 
8:20 AM
Faster than ptr += sizeof(obj)?
 
@jalf I'm just saying it's possible. When having a server application up and running for a long time, JIT compilation could most likely produce more effective code than statically compiled code.
 
I predict a lot of late night drunk gorilla - @sbi
(╯°□°)╯︵ ┻━┻
 
Xeo
you fail.
switch the braces
with the parens
 
fuck it
 
Xeo
[text](http://link)
 
8:23 AM
@jalf Especially if the behavior of the application changes drastically during time, and you could recompile it, based on the runtime information.
 
@ManofOneWay Yup, it's definitely possible
 
Recompilation isn't free.
 
I'm just saying that in practice, JITs usually fail to exploit this potential
 
Most JITs are designed to be fast.
So they don't have time to be all fancy on those optimizations.
 
They could blow statically compiled code out of the water, but... they don't
 
8:25 AM
the problem with JIT, is that you have to also run the program at the same time. with static compilation, you can (with in reason) spend all the time you want getting it just right
 
@RMartinhoFernandes Most of them, yes
 
If static compiler takes longer than JIT, then I don't want to use it.
 
@CatPlusPlus If a static compiler takes less time than JIT, it's not worth using ;)
 
Damn the parentheses - Full speed ahead!
 
If a bytecode JIT can exceed the runtime speed of a static compiler, then a native-to-native JIT can probably go faster than the bytecode.
But, it's easier to wait for the next generation of CPUs.
All anyone's gonna do with extra performance is just add another layer of virtual machine anyway.
 
8:29 AM
Virtual machine the best machine.
 
Xeo
@Cat, you drunk or in troll mode?
 
trollcat
 
Neither. I like VMs.
 
@Potatoswatter That's so true that it isn't even funny. While I was at MS, you were allowed to use as much bloat as you wanted as long as you fit under the time threshold.
 
Oh the horror.
 
8:33 AM
The most ridiculous performance issue I found during that summer was process that loaded the entire .NET framework (from C++) just to query for a drive letter.
 
Xeo
wat.
 
That's M$' bread and butter. Someone probably got a bonus for that.
 
Yep, that added about 10 seconds to the boot time of a machine because loading .NET is I/O bound and at boot, it's also contending with other processes for the disk.
More than 10 seconds IIRC... probably closer to a minute...
 
@Mysticial are you sure you never want to work for MS again?
 
0
Q: identify object property by placement in object

Hello-WorldHow do you identify an object by its place in the object. myObj.b = 2 can I go somethiong like myObj[1] to show 2 also? var myObj = { a:1:, b:2:, c:3:, d:4:, e:5:, f:6: }

what does this even mean?
 
8:36 AM
@bamboon I didn't particularly like that job I had that summer. But that doesn't mean that there isn't a different department that I'd like better.
 
@refp I think he means, myObj[1] would give you the 2nd object listed
Essentially a struct you can access like an array
 
he could mean that, or.. something completely different :s
 
Though what is up with that syntax anyway?
That's not javascript, or if it is, I'm not familiar with that kind of syntax
Nvm, seems he fixed it
 
@Neil he is trying to show how he would express the functionality he is looking for
or well, that's what I thought at least
 
@Mysticial That seems sensible. As long as the "time threshold" is set reasonable ;)
 
8:39 AM
@refp He wants myObj[1] to show 2, which is member b
 
oh, he wanted Obj[1] to be equivalent to Obj.b
 
Which it isn't, if you can get away with using 10 seconds for querying a drive letter
 
that +5 vote answer is wrong, there are ways of doing what he wants
 
@refp Yeah, it looked wrong to me in fact
 
@jalf In the most reasonable case, the time threshold is set according to some unit test, and doing something with twice the arbitrary complexity metric now feels slow, and 10x gets painful.
 
8:41 AM
refactor.me got the answer right
 
@Neil not really though, but its much better at least
 
@refp Why, what's wrong with his answer?
 
8:54 AM
0
Q: Template argument deduction on lambdas

vedosityI'd like to make a function that accepts an integer and an arbitrary function (with arbitrary return type and arguments), to be called like so: server.bind(tag, [&](std::string greeting) { return greeting + " earth."; }); Any ideas on how to set up the templates to get the lambda's return...

 
Oh hibernate 4.1.5, shall I compare thee to a summer's day? Thou art more lovely and more temperate.
 

« first day (639 days earlier)      last day (4308 days later) »