I've just asked a question on Stack Overflow which was a prime candidate for googling. I admit it was a poor question and with a little bit of research I would have found the answer.
What annoyed me was someone in the comments put a let me google that for you link. It got right up my nose.
I fin...
@R.MartinhoFernandes in C they're just char[] aren't they?
@Ken The only difference between C and C++ in this regard is the const qualifier. C treats it as a char[N] instead of const char[N] — PrætorianSep 20 at 18:00
LMGTFY - even if you did the actual Google and copy/pasted the answer, it's usually not a lot of work. The more insulting posts are those with two pages of C with i,j,k,l,m array-indexing, magic-number array declarations and for loops, char* and mallocs. 'Please eveyone, debug my complex code - I can't be bothered to try. First to come up with the fix, so I can deliver my assignment/project and get marks/paid gets a green tick, everyone else, tough - suckers!'.
Have you ever heard the phrase "use the right tools for the job"? Itunes doesn't sound like the right tool to make nuclear weapons with, and neither is this QA the right place to ask questions about nuclear weapons. — Tony The Lion14 secs ago
The question is as follows. A customer needs a specific amount of paper. The charges on the paper are:
.10 for single sheets.
.055 per sheet in multiples of 100.
.04 per sheet in multiples of 500.
.03 per sheet in multiples of 1000.
I know you have to use mod division somewhere. I'm not sure...
@MartinJames I think they just are doing activism against nuclear weapons or something
I just found out that you can do f.something() to call a static function on a class which is decltype(f), I always thought you had to do decltype(f)::something()
Even if the law says that you can't develop nukes, I don't think they require that every product explicitly state that it cannot be used to develop nukes.
Seriously, what are they protecting themselves against? Suppose someone is caught making nukes and... what? Goes to court trying to prove they were using iTunes somehow, and so... what? Apple should take the blame?
@Mysticial No, it's not a sword, it's a shield - like 'star wars' and about as much use. Like cockroaches, lawyers will arise from the rubble and try to sue anyone who might be responsible. iTunes will have a good defense.
template<class T, class U> auto f(T t, U u) -> decltype(t + u){ ... }
textbook example
@SethCarnegie I guess in the end, it's nothing more than that (or I'm just not remembering, my brain is tired), but it saves much typing. You won't need all the std::declval stuff to get an object of a specific type
@Xeo that is not helped by having the scope of the definition of a static member variable be in the class though if I can see
@Xeo you always need an instance of the class to access member variables, the fact that the definition is in the scope of the class doesn't make it an instance of the class
For instance, int X::f = g() will call the static function X::g if it exists because the rhs is inside the scope of X. If the class has member variables, those are not available on the right side of the = because it's not an instance of the class, it just puts you in the scope of X
hey guys, so i got linux and i thought i would get the code::blocks ide since it has the GCC compiler, but im having a problem, each time i hit "Build and Run" It says
/bin/sh: 1: g++ not found Process terminated with status 127