Sorry, but as a Berliner, I just can't help but have to post this one, too:
Brrr. So cold in Berlin today. Thanks to the amazing iOS 6 maps, I know why: http://24.media.tumblr.com/tumblr_many9aVldB1rhptwbo1_1280.jpg (from http://theamazingios6maps.tumblr.com/post/31970259679/berlin-antarctica)
Bwuahaha! No more Fucking in Austria! (In case you hadn't heard: There's a town named Fucking in Austria. Well, at least according to google, there is.)
I don't know how you guys can use C++11. I every placed I worked (or still work), we always had such old platforms to be compatible with that its impossible to use a decent compiler with C++11 support.
@sehe What? I don't feel like I miss anything because I don't have an iPhone. Not that I think google is a pillar of lawful, fair-minded, and humble business — but at least in Android I can turn off most of their spying devices.
@ereOn Comeau used to be a way out of this debacle. You could compile with the best C++ compiler (little) money could buy, and then use the platform's decade-old C compiler to produce a compatible executable from the C code Comeau vomits. From what I have seen the last years, though, Comeau seems all but dead.
So I have the following code:
#include <iostream>
template <typename T>
class funcky
{
public:
funcky(char const* funcName, T func)
: name(funcName), myFunc(func)
{
}
//private:
char const* name;
T myFunc;
};
#if 0
int main(void)
{
char const* out =...
@sbi Ermm. It's not as if that would be acceptible in environments that delay moving to newer versions of compilers... In effect you'd be moving to a newer compiler and complication build process
@sbi Good to know. Now I still have to problem of convincing my coworkers to learn C++11 and to change the internal policy from "the best tools freedom can bring" to "best tools money can buy"
He (and @R.MartinhoFernandes) recently claimed that it's a bad practice to pass std::function as function argument and that you should pass the function as a template argument.
I created a C++ library. I am using it in an iOS application. I thought of handling exceptions in C++ library and in order to test this I created a test scheme and called the c++ function from it. In the c++ function I intentionally wrote erroneous code.
try
{
int i = 0;
int j = 10/i;
}...
Doesn't scale well. The larger the classes, the longer it takes to copy them, (if it's even possible/safe). If the vector access needs a lock, moving pointers in/out is much faster than copying whole objects and so reduces the chance of contention. Any copying also implies that, at least temporarily, the data is in more than one place - not a good idea in general. — Martin James1 min ago
@MohamedAhmedNabil But, seriously take your questions to google and possibly Stack Overflow. Oh, and try to word them in slightly non-naive ways ("can I make a program print a picture of cats licking a dog" - why, yes of course, just program the stuff)
So this leading member of the German Pirate party, Julia Schramm, published a book. Not only do critics deem it almost unworthy to waste their time on writing a scalding review, her publisher also took down an illegal copy that was available on the web. Since she's a member of the party that promotes free copying, she's now at the center of a massive shitstorm.
@TonyTheLion He may have a point about the cost of copying. However saying that the vector access needs a lock doesn't make sense because he doesn't know if the program is threaded and if the vector is shared.
If you want to provide a way for a user to supply a callback to your class, you're better off using std::function, since templating the class on the function / functor type is not a very useful thing to do, as you experienced.
The problem arises from the fact that you can't just take anything in...
@R.MartinhoFernandes It's a major street in the center of Berlin. It passes right along the main train station, which is situated at a place where the Lehrter Stadtbahnhofused to be.
@TonyTheLion - refactoring an app to accommodate multithreading, (and the inter-thread comms that goes with it), is very difficult and awkward if it's already riddled with stack-based objects and copy-ctors. IMHO, it's better to consider such things from the start, especially if you want your classes to be re-useable. Also, I don't think that anyone actually likes writing copy-ctors if they can avoid it:) — Martin James4 mins ago
this guy is out of his mind
he seems to advocate pointers because they're "easier" to share between threads, because less copying
@R.MartinhoFernandes It's not enough to show the implementation though. I see two typical usages: emulating pack expansion over tuple elements EXPAND( pattern );, but also deconstructing tuples via overloads.
@TonyTheLion I'm +1ing your answer because it's the only one that mentions boost::ptr_vector. It is your best option when you are stuck with C++03, and it pisses me off that people decide to write those stupid delete loops instead of using ptr_vector.
@Insilico I think mapping software is very complex and that the current bugs are mostly due to lack of polish rather than due to a messed up codebase. (I could be wrong.)
And it pisses me off even more when people claim they don't want to use boost, and can't fucking think for a second and realize that they are supposed to use "a vector that deletes pointers automatically", regardless of whether it is from boost or not.
The choice is not between boost::ptr_vector and "stupid delete loop", but between boost::ptr_vector and "my own ptr_vector". </rant>
@StackedCrooked I think it's more that they have a poor data set. From what I have seen, the code seems to be sound. It's hard to navigate to the right place, if you have no knowledge of that place. In fact, the mapping side of things is rather simple job to do, just a series of 'nodes' with weightings and slap some A* on the mother fucker
@R.MartinhoFernandes because there are so many absurd procedures and processes you have to follow, and auditors who come and check that you follow the correct QA processes, rather than checking that the medical device you're making actually works
It's just QA gone wrong. At some point, people had the very reasonable idea that "if this piece of hardware is going to be used in life-critical situations, then we should probably have some kind of process in place for verifying that it works". And then it ends up derailing itself, so that the process merely verifies that you've written a stack of inane documents and invented the right numbers to feed into your risk analysis
boost::hash is not C++03, but boost. In environments that support tr1 (much more widely available than C++11), you can use std::tr1::hash<T>, defined in <tr1/functional>. — user48151623421 hour ago
@thecoshman OTOH, you stick words together to longer strings, only you leave the spaces in. For example, I am at a loss as to how to translate Sgt. Pepper's Lonely Heart Club Band into German, without stooping to "the band of the guy who..." Simply stringing words together like that just doesn't work in German.
@Insilico Actually, no. This, too, I would find hard to translate into German without using "...of..." This is genuinely English, only that the syntactic rules of t he programming language it's used in demands removal of spaces.
@sbi well... I assume you know perfectly well what it means, but to me at least, it makes perfect sense. Perhaps if it was phrased as "The band belonging to Sgt. Pepper called Lonely Heart Club", though maybe (As I am not to sure exactly what this means, it's a little bit ambiguous) "The band belonging to Sgt. Pepper who is part of the club called Lonely Heart"
@sbi 'stack-based objects make threading easier' - missed that one. To accept that places a heavy burden upon the logical and semantic resources of the English language, (I disagree:). — Martin James5 mins ago
Is it just me or is he gone completely bananas now?
@Insilico English had most of its grammar beaten out of it when the Vikings moved in to force the Angles and Saxons to share their land with them. They also brought a lot of Northern Germanic words with them (swine vs. pig, will vs. want etc.). Later the French-speaking Normans (basically French-turned Vikings) took over, and brought in their Latin-derived words. Add the monks pushing Latin into the language, and you have the mess that now makes up English.
@sbi I do believe that the old Celtic languages, other the Brythonic which was quashed, also influenced modern English as well, though not to the extreme of the Angles and Saxons
@R.MartinhoFernandes "You cannot read about the errors in Apple Maps without realizing that these maps were being visually examined and used for the first time by Apple’s customers". Ha!
This "Spring class" post trending on HN and G+ boasts an unequaled amount of suckage. This is typically the kind of behavior that makes the programmer community so despicable sometimes.
@thecoshman Actually, I was looking at your message and looked up the origin of every word I couldn't immediately place. Except for "Bythonic", I found nothing Celtic in it.
@thecoshman You do not have any native Latin, Old French, or Germanic speakers either. I was talking about the origin of words, not their current usage.
You're free to hate Spring but you have to provide solid arguments, and linking to a shitty class can be funny but in no way an argument for the quality of language design.
@kbok but it is fairly common in Java to overdose on design patterns. It's not entirely coincidental that a class like that showed up in a Java library
@jalf Of course it is not, but he's just picking up one class and saying Java sucks because of it. What does he know, maybe this class is really marvelous when you use it.