« first day (48 days earlier)      last day (4916 days later) » 

12:03 AM
@Akhil "Can anyone please give advice on whether I should use better Soft. Engineering or continue in the stereotypical way, my group has been doing?" Your question makes no sense to me. What's the question, again?
 
12:39 AM
@Akhil: People who still use vim & compile ont he command prompt are old, grumpy crumudgeons who cant write code as fast as me. :) use a modern ide
 
1:02 AM
@JohnDibling I'm sorry, I didn't hear you, your IDE is too loud. You were saying?
 
 
3 hours later…
4:17 AM
24
Q: Does the C++ standard mandate poor performance for iostreams, or am I just dealing with a poor implementation?

Ben VoigtEvery time I mention slow performance of C++ standard library iostreams, I get met with a wave of disbelief. Yet I have profiler results showing large amounts of time spent in iostream library code (full compiler optimizations), and switching from iostreams to OS-specific I/O APIs and custom buf...

A very good question.
 
 
5 hours later…
9:03 AM
Good morning everyone!!
 
 
2 hours later…
11:24 AM
good afternoon
 
sbi
Hi noon!
 
 
3 hours later…
2:09 PM
returning a reference to a private member of a class is that UB?
 
sbi
2:19 PM
@Tony No, but if it's a non-const reference it warrants questioning the design. Sometimes (like when implementing the non-const version of oeprator[]) this makes sense. At other times it's a code smell.
 
hmm
in my case I'm just returning a std::vector<shared_ptr<type> >, which I am going to modify after returning, I guess it can still be const right?
 
sbi
You can't modify a const object. You can, however, modify a non-const copy of a const object.
What does that function return, why, and what for?
 
it really is just a vector of pointers to a struct which contains various value's, it's really just a getter
so perhaps I should abandon the getter theory and just make the variable public
as I need to be able to access this vector to fill it up
 
sbi
@Tony The best solution usually is to raise the abstraction level, not to lower it.
 
what do you mean?
 
@sbi If you raise the level of abstraction too much you get Java.
 
so you saying I don't need getters & setters?
it's something that C# seems to promote though with their notion of properties
and coming from a C# world, I'd like to understand what the C++ way of thinking about it is
 
Perhaps you need an insert_element member function? (Or something better-named than that).
 
2:42 PM
hmm that makes sense
so what about a class that holds a private pointer to a child node, and you need access to the child from outside, do you make a function get_child or do you expose that child data member?
 
sbi
@Tony Why do you need to do something to a piece of private data in some class? Why wouldn't the class provide the means to do whatever you need to do? Do you ever need to reach into std::string's internals to perform some string operation? No, you don't. std::string is an abstraction that provides the means to do whatever you want to do with strings.
@JamesMcNellis No, you don't. See my std::string example.
 
@sbi you do have an interesting point, I just have to get my head around it I guess
 
sbi
@Tony In languages like Java and C# it's common to treat a class as a kind of glorified struct: an assembly of data objects, to be reached into from the outside to do something. But that's not what OO is about, that's just pimped-up Structured Programming.
In real OO you don't reach into a class' innards, because you're not supposed to know them. You call a member function to do something.
 
wow, that's very interesting. You've just changed my view on OOP.
2
 
sbi
You said you did .NET before, didn't you? <sigh>
 
2:56 PM
yes I did
 
sbi
:)
 
so i'm used writing getter setter properties that return internal variables from classes
 
sbi
Anyway, I have to leave now to pick up my kids. I'll likely be offline until tonight. See ya.
 
see ya
 
 
2 hours later…
4:49 PM
@Tony it's easy to write non-OO Java or C#; realizing that will help you cut through a lot of FUD
(Java is commonly propagandized as a "strictly OO" language)
or was, anyway
and non-OO is not synonymous with bad, just like OO is not synonymous with good
I can't find it just now, but there's an interesting interview from Stephanov (the main person behind the STL) about why he doesn't necessarily like OO (without calling it bad, iirc); this why for_each is a free function rather than being a method of each container
 
5:07 PM
help please:
0
Q: SFINAE compiler troubles

FredOverflowThe following code of mine should detect whether T has begin and end methods: template <typename T> struct is_container { template <typename U, typename U::const_iterator (U::*)() const, typename U::const_iterator (U::*)() const> struct sfinae {}; ...

btw, SFINAE is a nice name... maybe I'll name my daughter Sfinae, if I ever have one... just kidding :-)
 
5:19 PM
@FredOverflow; sry.. no idea
what happends if you try without the templates?
 
@Default I don't get it. SFINAE without templates???
 
a struct that works only for a set or map
 
@Default Not general enough, and I still don't understand exactly what you mean.
 
5:50 PM
reading up on SFINAE
 
6:03 PM
@FredNurk, so are you saying OO is good or bad?
 
6:27 PM
@Tony OO is neither good nor bad. Use it were it fits. Blindly applying OO to everything, however, is completely stupid.
 
Yea I agree that judgement is necessary
I was trying to understand what sbi meant with his explanation of abstraction
and how getters and setters should fit in that
if they fit at all
 
@Tony Getters and setters are the opposite of OO.
 
that seems to be the notion I've been getting here
 
@Tony Note this has nothing to do with C++, it's just "general OO wisdom".
 
@FredOverflow I must have missed it then, cause OO world is not particularly new to me
 
6:34 PM
@Tony Maybe OO world was too encapsulated too see that wisdom until just now? :)
 
hahah
it's more this concept about the hiding of private datamembers and not exposing them in any way directly that's new to me, coming from C# background, there it is normal to do that
even though it's not really OO as I've just learned
the question remains what would be 'right" way to do it then?
 
@Tony The observation that something "is not OO" does not mean anything. See Why C++ is not just an Object-Oriented Programming Language.pdf by Bjarne Stroustrup.
trying to make something oo by providing getters and setters does not make it oo.
 
sbi
I *still* think this is a brilliant quote: "I think that object orientedness is almost as much of a hoax as Artificial Intelligence."
also "Java is clearly an example of a money oriented programming (MOP)"
 
@sbi I like that, "Money Oriented Programming"
so what is OO then?
is it a pure abstract something
 
sbi
@Tony One of the tools in your toolbox?
 
6:41 PM
yea I know that much
 
it's just syntactic sugar
 
sbi
For C++, another important tool you should know how to wield should be Generic Programming.
 
yea but OO has some kind of purpose
 
like all abstraction, it's supposed to make your life easier if used correctly
 
sbi
@Gary Well, I'd say a programming paradigm is more than syntactic sugar. It shapes the way you program very much.
 
6:42 PM
OO is about building entities that do stuff without revealing how they achieve it.
A bunch of data sugared with getters and setters is not OO.
Notice how both "good" and "poor" contain "OO". I don't think that's a coincidence ;-)
 
lol
it's a different way of thinking about it I guess, one I will need to adjust to
 
but all the concepts are pretty simple to implement in C, virtual functions are just hash tables of strings to function pointers.
 
btw i really suggest you read that paper by stroustrup.
 
sbi
@FredOverflow It's not coincidence, it's cOOrdinated. :)
@Gary Huh?
 
@sbi sometimes it can also be quite cOOl :-)
 
sbi
6:45 PM
@FredOverflow Downloaded and opened.
 
@FredOverflow I will read it :)
I like Stroustroup reading
 
like, figuring out which function to call based on object type is just a look-up table
 
sbi
@FredOverflow Just like bOOst?
 
It depends on my mOOd, but mostly I enjoy stroustrup a lot :)
@sbi Oh yes. And let's not forget about fOObar!
 
of all the C++ books I've read, I think Stroustroup's have got to be the best I've yet read
 
6:47 PM
Can you wOO women with class? :-)
 
lol
 
@Tony The "Programming" book is awesome, the "TC++PL" book I find rather boring, to be honest.
 
hehe
:)
 
member functions are just static functions, when you call them, you implicitly pass in the 'this' pointer as the first argument
 
7:44 PM
hi folks. consider:
struct Point{ double x; double y; };
then consider in a class Vector:
private:
    Point end_;
versus:
private:
    double x;
    double y;
now which would you expect to be most efficient?
 
the only difference could be from memory alignment and resultant class size?
double x; double y; could be marginally more efficient
 
actually i got a ~3 time speedup with Visual C++ 7.1 :-)
 
haha ok, maybe an optimization is helping
try it with different compile options
 
it was due to compiler then (with individual items) recognizing that they were double values and just pushing them on fp coprocessor stack. it peeked inside function calls and all to do it. but not with the struct. :-(
 
oh gotcha
wouldn't have expected that
 
7:51 PM
i don't understand why it doesn't "see" the same opportunity with the struct. it is after all logically equivalent. but, one data point on Speed of Various Constructs...
 
is there a function call in between?
your op and getting the data?
 
wait a sec
 
at any rate, seems like they missed a chance for optimization
 
double areaOf( Polygon const& polygon )
{
    Size const  nPoints = polygon.nPoints();

    if( nPoints <= 2 ) { return 0.0; }

    Point const* const  points  = &polygon.at( 0 );
    double  doubleArea  = 0;
    for( Index i = 1;  i <= nPoints;  ++i )
    {
        Vector const startOfLine    = points[i - 1];
        Vector const endOfLine      = points[i == nPoints? 0 : i];

        doubleArea += startOfLine*rotatedLeft( endOfLine );
    }

    return abs( doubleArea )/2.0;
}
With individual x and y items it recognizes that the expression update of doubleArea can be done very smartly (it inlines the function calls)
 
right
if it's inlining it doesn't have to copy values into the fxn
or save/restore registers
 
7:58 PM
yeah, but i was suprised it doesn't do that when instead of x and y I use a single POD struct with x and y
should be the same
but it just doesn't recognize that it is the same, and then creates memory objects for startOfLine and endOfLine, with inefficient copying
 
there's gotta be a way around that, b/c all that stuff can be determined statically
I can't believe that every Struct operation compiled with VC++ can be 3x faster :-)
and no one noticed
 
Is there any type in the STL that has a const_iterator nested type but does not offer begin and end member functions?
 
possibly a traits class? lemme check
@FredOverflow are you answering some homework question?
nope, can't see any const_iterator in traits classes
 
8:26 PM
@AlfPSteinbach What? No, I want to find out if some type T is a container, and this still does not work. So I thought checking for the const_iterator could be enough.
 
8:54 PM
@FredOverflow maybe it's easier to check that something isn't a container. like, default implementation assumes standard-convention container. specializations deal with other cases
 
sbi
9:18 PM
I think Noah has done a much better job on answering Fred's question than what we have seen of him lately.
 
 
2 hours later…
11:03 PM
@sbi agreed
 
11:23 PM
hmm
@Alf thanks for making me think again about that old bug report xD
 
N3225 is now available.
4
The implicit move resolution is interesting.
 
i commented to the author of the new/override/final paper about one thing that annoyed me though.
i like all the resolutions they found. very sexy
 
I'll have to think about it and read some more; I've only just glanced at it.
 
litb, did you just describe the C++ Draft Standard as "sexy"?
 
lol
it makes me horny
2
 
11:31 PM
something ias very broken there :)
well it's beer-o-clock here, and my woman is waiting for me. peace out yall
 
Either I am always here at the same time every day, or John decides that it is beer-o-clock any time I come to the chat room.
3
 
sbi
@JamesMcNellis And also note that everybody comes here the moment I plan to go to bed, and then just left when I got up in the morning and have a look here. Nobody wants to play with me either, James, not even you! :)
Anyway, it's sleep-o-clock here. G'night.
 
Goodnight
 
11:38 PM
Well, they fixed my defect.
 
sbi
@JamesMcNellis ROTL! Your defect? So now you're finally not broken anymore?!
 
@sbi: No, silly. The defect I submitted to the LWG. I am hopelessly broken.
 
:o i need to update all my answers and replace most "used" by "odr-used"
 
sbi
Oh well. At least I tried... :)
 
BTW the lwg issues list is publicly managed with git
so you don't have to wait for the next mailing to see whether your issue report was accepted :)
 
11:40 PM
Oh no. They've replaced "used" with "odr-used?" I guess that makes sense...
@JohannesSchaublitb Oh?
 
Is that new?
 
afaik it's a rather recent installment
core issues list isn't that open :/
 
I haven't found any CWG defects. I'm not that smart. Most of my comments have been typographical or in non-normative text.
 
poor James
lol
 

« first day (48 days earlier)      last day (4916 days later) »