« first day (82 days earlier)      last day (4864 days later) » 

9:00 PM
@wilhelmtell it is not, unfortunately, objects that make something object oriented
it is messages
 
@FredNurk ok. i was thinking to cut through it by learning a wholly OO language.
 
Refer to my Starred post....
 
@DeadMG right.
 
@BeeBand: there is no wholly OO language; none, nadda. you can write non-OO code in any language
 
sbi
@DeadMG Note that the result of std::type_info::name() is implementation-defined. An implementation might return empty strings or "blah" for all types or different strings for every program run and still be standard-conforming. You should use std::type_info as a map key instead.
 
9:01 PM
@JamesMcNellis Yes. And yet C++ is not object-oriented. Some people say "C++ is not a pure OO programming language". I say there's redundancy in this statement, but it means the same as "C++ is not object-oriented". But yes, it does support object oriented programming. Just like humans aren't blind, but they can put a blindfold on their eyes.
 
sbi
@FredNurk Smalltalk?
 
@sbi: It didn't matter, as long as they were consistent for each execution.
 
@FredOverflow C++ doesn't support messages at all. Messages rely on a runtime system which C++ doesn't offer.
 
@wilhelmtell by your definition, Assembly supports object oriented programming, if you write the right statements
Allows and supports are two different words
 
sbi
@DeadMG I'm not sure they need to be. In practice they probably are. I only ever used std::type_info::name() for debugging purposes.
 
9:02 PM
@sbi: a "pure OO" language can't exist because OO is a collection of practices rather than something that can be rigorously defined (as in mathematics)
 
sbi
@Xaade Yes, and it can.
Albeit the syntax would be very clumsy.
 
@Xaade No, that's wrong, again. What compiler features and syntax features does Assembly have that support OOP exactly?
 
@sbi: I'm pretty sure that typeid(T).name() has to be consistent between executions.
 
@wilhelmtell: C++ has a runtime system for passing messages: it's called virtual functions
 
sbi
@DeadMG As I said: I dunno.
 
9:04 PM
@DeadMG: iirc, that's underspecified in 03 (and I don't know how 0x might change it); practically (in 03) you can expect they don't change across executions without recompiling
 
@wilhelmtell What features does C++ have? A class is not an object. C# classes are objects.
 
@FredOverflow there's a very fundamental difference between messages and virtual functions. It's the dynamic dispatch difference. They two use two different approaches to implement dynamic dispatch.
 
(changing after recompiling usually doesn't happen, but much more compiler-specific)
@wilhelmtell: try "@fredn" or press tab twice
 
@FredNurk messages don't have a virtual method table.
 
@Xaade: single-root inheritance is very different to being OO. The name "Object" and it's enforced inheritance is irrelevant.
 
9:06 PM
@Xaade: as some are so fond of pointing out, vtables aren't mandated by the standard
 
@FredNurk sorry, I was using what I'm used to in C++.
 
@Xaade So what if a class is not an object in C++? C++ has the class keyword to create classes. C++, the language, describes how to use polymorphism, encapsulation and inheritance. These are the three building blocks of an object-oriented programming language. Therefore, C++ supports object-oriented programming.
Assembly doesn't have any of these features, and it doesn't support object-oriented programming. C only has polymorphism and to a lesser extent encapsulation, so it doesn't support OOP.
 
sbi
@FredNurk Wow, I didn't know you could access these hints by tab! That's a good one I should add to my newbie hints.
 
@Xaade: but that is still like saying my modern car doesn't use a hand-crank, and everyone (and I mean everyone, circa 1920) just knows cars use hand-cranks; therefore my car isn't a car
 
@wilhelmtell No, it doesn't describe how. Those are design patterns.
Sorry, it does describe inheritence
 
9:09 PM
@Xaade again, I don't know how you define the term "design pattern". The reality is that most people define it very loosely, so for this argument it's practically useless.
 
@Xaade: The C++ Standard does define inheritance, polymorphism, and encapsulation. If you think it doesn't, go read it again.
 
@Xaade: where does C#, or any other language, "describe how to use polymorphism"?
 
I'm sorry.... I misunderstood "describe"
 
@Xaade: I'm very certain that no current language (possibly only no currently popular lanugage) describes how to use polymorphism, inheritance, or encapsulation
 
We need downvoting in chatrooms. Seriously.
2
Some compensation for lost time.
 
9:13 PM
As you can see, it's hard to define whether C++ is OO, because it's hard to define what is OO. Does the ability to implement OO concepts make a language OO, or does language support make the language OO.
 
@Xaade: That's an obvious one. Language support makes a language OO. How can anything else except a language make a language OO?
 
@wilhelmtell click user > hide posts or ignore everywhere
 
@DeadMG then that's how I say C++ isn't OO. You can create objects by using classes, but classes are not objects. In an OOL, everything is an object, and everything else is how objects interact.
Crafting OO code, and being an OOL are two different things
 
@Xaade: No. That's an exclusive OO Language. Supporting other paradigms does not make a language non-OO. The "everything" in that sentence is utter bull.
The correct wording would be, "In an OOL, anything that wants to be an object can be, and anything that needs to be can be defined by how they interact."
 
Ok, from my point of view.
Is a 3G phone with a music app and 2G internal memory a MP3 player?
Or is it a phone?
 
9:23 PM
@Xaade: It's clearly both. Can you make calls? Yes. Can you play music? Yes. It's both.
 
@wilhelmtell Yes, we are in agreement.
 
@DeadMG therein lies the disagreement.
 
@Xaade you're forgetting to apply OO: it's both
 
@Xaade: No, therein lies your blindness. SRP is great for objects, but it sucks for general-purpose things, such as languages. My CPU is both an integral processor and a floating-point processor, and trying to brand it as one or the other is plain stupid.
Even in C#, I can inherit from as many interfaces as I like. My MP3-playing 3G phone can be both- even according to OO's own rules.
 
@DeadMG SRP is better applied to interfaces, which objects then support one or more of
you don't have an output formatter which also handles input formatting and buffering, you have an ostream, istream, and streambuf
and you don't have separate input buffers and output buffers, because this particular concept of buffering works on the exact same underlying "object" (e.g. a file)
 
9:31 PM
@Fred Nurk: No, the C++ IOStreams library is not written that way. I, however, most definitely would limit it to input and output. Buffering is an implementation detail.
 
iostreams is actually written that way
 
@FredNurk: Typo. I meant that it is written that way.
 
then you also forgot s/No/Yes/
I think you misread what I wrote :)
 
The only reason I don't have an output formatter which also handles buffering is purely because the IOStreams library is written that way. Buffering is an implementation detail and should not be an interface.
If I had my own stream library, then I would have an output formatter that also handles buffering.
 
you can pretend there doesn't exist any buffering interface and only use what is already provided (most do)
@DeadMG that may be fine, but it breaks SRP
 
9:34 PM
@Fred Nurk: No, it doesn't. My output formatter's job is to output in a formatted fashion. The buffering is an implementation detail that makes it more efficient.
 
formatting is separable from buffering, and users will quickly notice and demand this; the combination of the two is how conjoining them breaks SRP
 
Of course formatting is separable from buffering- buffering is a far more generic thing than formatting. That doesn't mean that my formatter should provide a buffering interface. Because a formatter that had no buffering would be perfectly viable and meet all the necessities of the output formatter.
 
if you were, instead, trying to skip one of the perceived practical disadvantages of iostreams: virtual dispatch everywhere, then you can do that without breaking SRP
 
sbi
Woah! What a heated discussion! Can you please tone it down a bit? The kids are sleeping here.
3
 
a "null buffer" is still a buffer, just take a look at /dev/null
 
9:38 PM
I was beginning to realize that no one needed my digression anymore...
Digression digresses itself.
 
chat digresses itself.
 
Hence, "Chat"?
As opposed to "Meeting"
 
Xaade, I was indeed much happier when you were silent. @sbi: There's no heat here. @Fred Nurk: On earth is /dev/null? It's not a responsibility of output formatting to provide a buffer or discuss it or anything to do with buffering. They're completely independent.
 
sbi
@DeadMG "I was much happier when you were silent." Sure, no heat at all. :)
 
@sbi: That is a fact, and being a fact, stating it is an inherently unheated action.
 
9:42 PM
@DeadMG: "It's not a responsibility of output formatting to provide a buffer or discuss it or anything to do with buffering. They're completely independent." doesn't reconcile with you making buffering a private implementation detail of the formatter
@DeadMG I doubt you could get more offensive than that comment while remaining civil
 
Some facts are better left unstated.
 
@Fred Nurk: Of course it does. My output formatter is not under any obligation to provide a buffer or inherit from any buffer interface. I could perfectly happily write a formatter with no buffering and no code anywhere that even looks at buffering.
 
"I hate you." "Oh, that's just a fact, no argument intended." just, wow.
2
I need a break
 
My argument was better understood in reference to the question it was addressing.
Would it be helpful to learn a [purely] OOL, in trying to become better at C++
Answer = no.
 
Even the idea of a "pure" OO language is ridiculous.
 
9:46 PM
I didn't intend to make you less happy than you were while I was silent. I intended to be of help to the person I was addressing.
Even if you disagree with whether C++ is an OOL. The advice was still applicable.
 
Not entirely sure that I was actually here when the original question was asked
 
No, but you felt free to engage me on whether C++ is OOL, when that wasn't even helpful in addressing the OP's question.
 
10:09 PM
Ah yes, the age-old "what is an 'object'?" question. It always brings out the best in everyone!
 
@JohnDibling It's a region of storage. This is a C++ chat room, right?
 
@Charles: Supposedly, but the natives can get frisky :)
What was a C++ chat room suddenly becomes a Monty Python movie.
 
@JohnDibling: It's just a flesh wound.
 
This one's challenging my understanding of temporaries.
2
Q: How to properly return std::string (or how to properly use that returned value)

user566129Say you have a class wich is a global (e.g. available for the runtime of the app) class MyClass { protected: std::string m_Value; public: MyClass () : m_Value("hello") {} std::string value() { return m_Value; } }; MyClass v1; Using the first form gives me odd behavior wh...

 
@CharlesBailey Your comment was correct.
 
10:21 PM
@TomalakGeretkal: you should scroll up a few hours, you'd enjoy it
 
@CharlesBailey you're absolutely right, I misunderstood in my first reading
 
@FredNurk To anything in particular?
 
I had a strange case of this before, in which a variable was created by the first argument in a call to a method, and it's pointer reused in the third argument. After turning off compiling efficiency, it started working as the code read.
Method(v1 = new object(), arg2, v1->pMemberVar);
 
@TomalakGeretkal: starting from chat.stackoverflow.com/transcript/message/231559#231559 or a bit later (and I miss grep here)
 
I appears as if the compiler send copies of the arguments first, before it actually executed the new statement. Of course made the third argument a null value.
 
10:30 PM
@Charles: You are correct, villintehaspam is wrong
 
@Xaade arguments are evaluated in an unspecified order
@Xaade: this is partially the cause of f(new int, new int) being unsafe, for example, even though neither parameter depends on the other
 
@FredNurk yes, it wasn't valid code. However, turning off compiler efficiency options in VS "fixed" it. Not to say I should have left the code that way, as I did change it later on. Just saying, that maybe that issue is related somehow?
 
compiler optimizations will easily affect anything unspecified
 
When would the string have the chance to change it's data pointer?
 
unspecified here differs from implementation-defined and from undefined: ID would require the compiler to document it and be consistent, and it is certainly not UB
@Xaade: *v1 doesn't get a chance to change anything, it's v1 (the pointer) that changes in one of the arguments: whether that change happens before or after evaluation of any other particular argument (such as v1->...) is unspecified
if v1 was previously a null pointer, then it is unspecified whether f(v1 = new T(), v1->member) invokes UB
I take it by the deletions that you understand now? :P
 
10:38 PM
@Fred: actually, I think that is OK
 
@CharlesBailey Sorry, I'm referencing the question here.
 
the comma introduces a sequence point
 
@John: commas in function calls aren't the comma operator and have no sequence point
 
In my example, I know exactly what went wrong. v1->member evaluated first. I just don't see how it broke in the question
 
oh, sorry, you're right. i wasnt thinking in the right context
 
10:40 PM
@Xaade: if you mean this question, several people have said how the actual code posted doesn't match the ascribed behavior
 
Hah, missed that point.
 
@Xaade disasm the binary compiled with optimizations, and without it, then we'll see what optimizations did to cause that.
 
@jweyrich wish I could. The code's been changed to initialize the parent variable before referencing it in the method call.
But my results were the same as the question. It either worked, or dumped, and did so at "random".
 
WinCE compiler, I don't trust it.
 
Meh, wasn't the compiler's fault. That was just stupid code. Kinda like.
 
10:46 PM
@CharlesBailey "In g++ we trust."
 
This one may not work. Unsafe.
Class class = new Class(), class2 = new Class(class);
 
@Xaade If you are still referring to stackoverflow.com/questions/4620456/… then I disagree. There's nothing fundamentally wrong with the use of the temporary, but obviously if you have to work around compiler bugs then you do.
 
@CharlesBailey no need. I know it should work.
afk.
 
@Xaade Just a risk of a memory leak in case of an exception AFAICT.
Also, you meant Class*.
woah
Loads of answers seem to have vanished from that question..?
 
@Xaade variable initialization order is always left-to-right, int a = 3; int b = (a = 42), c = a; always assigns 42 to c (and I did that weird initialization dance to avoid using a garbage value if you were to assume unspecified order)
 
11:01 PM
@TomalakGeretkal That seems to happen a lot when I comment on answers ;) .
 
:P
well I'm not complaining. rep leader now. :D
 
LOL!
 
11:31 PM
lulz
@CharlesBailey "what's an object" is also discussed on comp.lang.c++ right now
 
@JohannesSchaublitb Yippee!
 

« first day (82 days earlier)      last day (4864 days later) »