Slashdot is powered by your submissions, so send in your scoop

 



Forgot your password?
typodupeerror
×

Comment Re:slashdot and languages (Score 1) 336

All points you made are wrong :D

So, you had failed a simple job interview about C++ based on wrong answers regarding constructors, wow ... and you still think the language is easy, when you are not even aware that the member variables are not initialized at all when there is no constructor?

I did not define a virtual destructor as it is irrelevant for this example.

Good, now you know the member variables of B are not initialized at all, dare to try a new answer ... considering that I already pointed out "there might be a difference depending on compilation units" ???

My bet: your answer will be wrong again ... but no problem. C++ is such an easy language you pick this particular problem up quite quickly :D

Comment Re:Answer (Score 1) 336

Perhaps read a book about the Taligent Frameworks?

When do you use (single) inheritance? When you "extend" a class or when you "specialize" a class? Whenever you want to extend a class in C++ (lets name it B) you should not inherit from it but craft a new class (lets name it N), worst case via a mixin template construct, and compose the desired class by multiple inheritance so that D is specializing B and N.

That way you can reuse N without being dependent or messing up D or B.

The simplified single inheritance and interface model caters for all practical examples, and *vastly* simplifies the internal workings. (X)

No, it does not. As you have to program the implementation of everything you "inherit interface wise" multiple times everywhere where you "implement" that interface.

If you want to use simple delegation (via IDE code generation etc.) the delegatee loses the original this pointer ... (X) above No simplification but a complication.

How large is a pointer to a member variable?
That is a stupid question. Yes, I know there are no stupid questions, only stupid answers. However asking questions that don't belong to the context: is stupid.
Answer to your question: implementation dependent. What exactly do you mean with a pointer to a member anyway? A true C++ member pointer? Like &classname::member? Usually as big as any pointer on the given platform. But can be optimized as small as a byte, however I'm not aware of any compiler that does that.
If you mean &object.member, a safe bet is: the size equals the typical pointer size on the given platform.

Comment Re:Answer (Score 1) 336

I did not argue about "shared_ptr", that was someone else.

The article you linked is bogus. I stopped reading after this: Ownership of resources is a central part of software engineering.

That is plain wrong. The idea of "ownership" was introduced with C++ ... it is a completely flawed idea to approach resource handling especially memory management.

Example:
class Person {
Person *spouse;
}

Who owns whom, when to delete the spouse? Obviously the idea that one person owns the other one makes no sense in terms of C++ ...

Comment Re:slashdot and languages (Score 1) 336

C++ is harder than other languages.

E.g. "a constructor for a class is auto generated by the compiler when needed"

Under what circumstances does this rule apply?

Oh, and what are the pitfalls?

E.g.

class B {
int i;
float f;
}

class D : public B {
int s;
public:
      D() {
          s = 5;
      }
}

B b;
D d;

What value has b.i?
What value has d.i?

Hint: consider B and D to be in different compilation units.

My bet: your answer is wrong.

Wow: that above was a super simple example about problems in C++ that make C++ a very hard language

Comment Re:None. Go meta. (Score 1) 336

Yes, it should.
But actually C++ is a beast of a language which no one so far quickly mastered.
All we have now in C++, like STL, boost etc. is stuff that was envisioned by people who minimum had 10 years language experience before they even came to the idea to (ab)use language features like that.
When I read the first time about the concepts of the STL (that was round 1993, and it was not even called STL then) I was shocked about its simplicity and that I was so dumb that I never came to that idea myself. Basically the only "genious" I had at that time was that I had invented "traits" myself ... because I needed them. (Had about 5 years C++ experience then)

Comment Re:LOL; What a fucking bozo you are (Score 1) 268

And as to 4 above, that stands on its own. Again, OCO2 shows how much China emits, which is far far more than is generally admitted since Chinese leaders are lying.

How stupid are you?
Who cares what China is saying?
We know how much CO2 they produce by simply counting their oil, coal production, cars and power plants.
Man, what a no brainer.

No idea why you try to use propaganda links like the first one, which is an _american_ ... obviously they cheat with their "officially" released data, like you claim China would.

China's emissions from 1850 on, exceed America's total.
Very unlikely and no one can figure which is the case as we have no data bout that, neither from China nor from the USA, so it is completely brain dead to argue about that.

Slashdot Top Deals

We are each entitled to our own opinion, but no one is entitled to his own facts. -- Patrick Moynihan

Working...