« first day (418 days earlier)      last day (4531 days later) » 

Xeo
9:00 PM
@RMartinhoFernandes Damn you were faster than me
 
struct Octree222
{
    Octree* a[2][2][2];
};

int main()
{
    Octree222* p = new Octree222;
    p->a[0][0][0] = new Octree;
    p->a[0][0][1] = new Octree;
    // ...
}
 
@FredOverflow: thanks for the "array-to-pointer decay" keyword, think its helpful
 
Aahahahaha, it works when I run it from MSYS.
 
@JohannesRudolph It's covered deeply in the FAQ.
 
Gotcha, you bastard!
 
9:00 PM
Does your code lose your individuality if I point out a bug?
 
@Fred: so struct isntead of typedef
... nice one
 
It shouldn't. It's just code.
@JohannesRudolph That's what boost does.
Just saying.
 
look, my C experience is epsilon
 
With a billion more lines though
 
And gives you iterators and everything.
 
9:01 PM
Who cares about boost LOC? Hint: you're not maintaining it.
 
Xeo
Seth, stop that random bullshit complaining. It's useless, everyone in this room knows that using Boost is way better than handrolling your own buggy solutions.
 
Come on guys, let him suffer a little more, then someday he will actually appreciate boost.
 
Xeo
Well, everyone except you it seems.
 
Yes, apparently I am the only one who can handroll not-buggy solutions
the way you guys talk
 
9:02 PM
Ahahaha.
 
Xeo
Show me a handrolled Boost.MultiArray bug-free code
 
Sorry, I meant "Right."
 
The keys are like next to each other.
 
Xeo
9:03 PM
Even Boost isn't bug-free from the get-go. The thing is: It has years of experience and usage and coverage.
 
Idea for getting rich: sell a keyboard with a std:: key to make C++ programmers more productive.
6
 
@FredOverflow brilliant
 
Xeo
@FredOverflow And a boost:: one
 
how about using namespace std?
 
Xeo
@JohannesRudolph Don't
 
9:04 PM
No.
 
#define abusing using
 
Xeo
:)
 
@JohannesRudolph please don't
 
That's my line!
 
alright, my c++ experience is epsilon too
 
Xeo
9:04 PM
@CatPlusPlus Not anymore, you didn't copyright it
 
I don't have to, it's on CC per rules of SO.
 
Is it common practice to avoid using namespace std; in favor of std:: ? just curious
 
@JohannesRudolph yes
 
Xeo
yes
 
9:05 PM
@JohannesRudolph in header files mainly
 
No, always.
 
alright, headers makes a lot of sense
compilation is slow enough already
 
In headers because if you do it there, every file that includes that file will have using namespace std; in it and polute their namespaces
 
Xeo
only things from std:: you should be using is swap and placeholders
 
That has no effect on compilation speed whatsoever.
 
9:06 PM
but y would you want to avoid it in cpp fules?
 
Someone said it first.
 
58
Q: Why is 'using namespace std;' considered a bad practice in C++?

ManaOkay, sorry for the simplistic question, but this has been bugging me ever since I finished high school C++ last year. I've been told by others on numerous occasions that my teacher was wrong in saying that we should have using namespace std; in our programs, and that std::cout and std::cin are m...

 
sbi
46
A: C++ Standard Library: How to write wrappers for cout, cerr, cin and endl?

sbiAlex has given you an answer how to syntactically solve that problem. However, I want to point out two other arguments regarding this issue: No matter whether you're employing a using directive (using namespace std) or its lesser evil sister, a using declaration (using std::cout), overloading ...

 
namespace pollution is a good arg too
thx guys
 
> It took most of us very few weeks to get to used to write the prefix and after a few more weeks most of us even agreed that it actually made the code more readable. (There's a reason for that: Whether you like shorter or longer prose is subjective, but the prefixes objectively add clarity to the code. Not only the compiler, but you, too, find it easier to see which identifier is referred to.)
 
9:07 PM
Naming collisions, obscured origin.
 
sbi
@RMartinhoFernandes But using is good for other stuff as well, not only for abusing namespaces!
 
> Explicitly prefixing everything doesn't do any harm, takes very little getting used to, and has objective advantages. In particular, it makes the code easier to interpret by the compiler and by human readers - and that should probably be the main goal when writing code.
 
abusing std::swap;
 
#define ADLing using
ADLing std::swap
 
sbi
@FredOverflow You wish. Well, we wish.
 
Xeo
9:08 PM
You know, until C++11 all using directives and declarations were frowned upon
 
uh using namespace std is bad. i don't knew that
 
Seriously, I can type std:: in 0.1 seconds.
 
Xeo
What's with using aliases in C++11 however?
 
using FTW.
 
std::std::std::std::
It's not that hard.
 
9:09 PM
@Xeo Even without templates.
 
@rekire The problem is that practically every book teaches using namespace std; on page 1.
 
I prefer using to typedef.
 
user142019
using namespace std = s;
 
Xeo
@RMartinhoFernandes Yeah, cleaner syntax
 
@FredOverflow And in the case of hello world, it actually takes longer to type!
 
9:10 PM
template <typename T> abusing foo = boost::variant<x<T>, y<T>>;
 
Oh, a space after template? :)=
 
Xeo
@WTP no, namespace s = std;
 
@WTP You're looking for namespace s = std;
 
wow you can have templated usings?
 
And don't do that.
 
sbi
9:10 PM
@WTP Oh please! Didn't you get the memo?!
 
Not with std.
 
@CatPlusPlus It's infective.
 
@FredOverflow yes i had this at university too
 
namespace io = boost::iostreams; is okay.
But std must stay std.
 
user142019
@sbi It's just that I forgot, for one time…
 
9:11 PM
hey guys
 
sbi
@WTP This wasn't about your messed-up syntax, this was about readability.
 
@FredOverflow i see the problems with that, i rode the answers... +1 :)
 
"read". The past tense of "read" is "read".
 
Also, no wonder C++ is not a sex toy, with all the std inside.
4
 
sbi
@WTP Imagine you come across a strange body of code, and find it's full of s::vector, s::sort(), and the like. Ugh. What does that mean? "...it makes the code easier to interpret by the compiler and by human readers - and that should probably be the main goal when writing code." (I wrote that, actually. I only realized that now.)
 
9:12 PM
ups sorry
 
namespace almost_boost = std;
 
@FredOverflow: thanks for your help with the MD stuff, got it working. Thanks a million!
 
user142019
It is horrible.
 
Or maybe the other way around?
 
@CatPlusPlus: What's wrong with -fomit-frame-pointer?
 
9:13 PM
namespace almost_std = boost;
@KerrekSB Everything.
 
I suspected you would say that.
 
It breaks debuggers.
KILLS THEM DEAD.
 
@CatPlusPlus What if you don't want to debug? What if you have no bugs?
 
not sure how to solve this: have a funciotn in two classes that is the same, but the difference is that one variable is different its the sprite object. I made a mother class but it asks me for that "sprite" object which is different in both classes. How can i solve this?
 
Right.
 
9:14 PM
Cough.
 
sbi
@KerrekSB maybe the problem is that you could misspell it as -vomit-frame-pointer?
 
@CatPlusPlus Hey, now that's my line!
 
Xeo
@CatPlusPlus namespace stdnext = boost;
 
I've attributed it in invisible ink.
 
@sbi Quite. I'm all in favour of not adding that :-)
 
9:15 PM
lol
 
sbi
@CatPlusPlus I suppose by "debuggers" you mean GDB? I think I haven't managed too crash VC's debugger in years.
 
Now that I compiled the damn thing, I should be doing those assignments.
But I'm too bored.
 
@sbi Did you try debugging something compiled with -fomit-frame-pointer?
 
It does.
 
Xeo
Oh, right
 
sbi
9:16 PM
@CatPlusPlus No assignment operator, eh?
@RMartinhoFernandes No matter what I've compiled a program with, the debugger should never crash. (There. Was that so hard to think of all by yourself?)
 
A dictionary implemented with BST. In Oz. In Emacs, which also failed to load the config, and I don't know how to force it to.
 
@sbi Well, "breaks" could mean a lot of stuff. Like "stop working".
 
Why, why, why would you integrate your REPL with Emacs, of all things.
 
You can't debug something whose frame pointer was fomitted.
 
Like "show completely meaningless backtrace".
 
sbi
9:18 PM
4 mins ago, by Cat Plus Plus
KILLS THEM DEAD.
 
@sbi I suppose that was a bit of artistic license.
Like, hyperbole.
 
And a half.
 
sbi
@RMartinhoFernandes Why not? I did debug optimized machine code in VC.
 
@sbi Come on, I'm the robot here. Getting figures of speech is the meatbags game.
26
A: What is the purpose of the frame pointer?

ssgFrame pointer is a reference pointer allowing a debugger to know where local variable or an argument is at with a single constant offset. Although ESP's value changes over the course of execution, EBP remains the same making it possible to reach the same variable at the same offset (such as first...

 
sbi
@RMartinhoFernandes I'm sorry, but the common meaning of "killing an application" is for it to be crashing.
Ha, planted a link to this answer a few mins ago, and now I'm harvesting upvotes on it. :)
 
9:21 PM
0
Q: C++ return value created before or after auto var destruction?

maxpolkIn C++ is a return value guaranteed to be created before automatic variables in the function are destroyed? Notice Basket::get: class Basket { public: // Gift is a struct containing safely copyable things like int or string Gift gift; // Used to protect access and changes to gift Mutex ...

Interesting.
 
@JohannesRudolph Did you settle on the struct?
 
Xeo
@sbi I'd rather harvest answers than upvotes on this question :(
 
sbi
@Xeo I had looked at it earlier today, but since I haven't done any serious C++ for >2 years, and since it's too long for my current attention span, I had to give up on it.
 
@sbi I hope you didn't mind me quoting your opinion on std:: :)
 
It killed Napoleon's army.
 
sbi
9:26 PM
@FredOverflow Well, it is CC licensed, so even if I would mind, you'd be allowed to quote it.
 
@coolbartek How about ditching the OO madness, and then writing a simple free function that takes the sprite as a parameter?
@sbi I'd still feel bad about it, though.
 
sbi
@RMartinhoFernandes You mean the Steven King novel?
 
@sbi No, syphillis.
@jalf lol
 
sbi
@FredOverflow That's a noble gesture. But why would I mind you advertising my answers? :)
 
9:29 PM
hah, C++ came second-best in terms of security in that report
 
@jalf Followed by Visual Basic !
 
and ".NET posted the worst security score and Cobol the best."
this just made my day
 
yes, settled on the struct. fairly clean approach.
 
Xeo
@jalf Can I post a question asking "Does Java code stink?" and you post that as an answer?
 
I suspect some self-important meta-police representative would throw a fit
but I'm definitely bookmarking it. Will come in handy, I'm sure
 
9:31 PM
lol
 
Xeo
@jalf In secret, they're all writing Java code
 
@JohannesRudolph agreed
@Xeo lol
 
Xeo
@jalf C++ was only beaten by Cobol thanks to the age difference, surely.
 
or because cobol is primarily used at banks, and they tend to be pretty paranoid about security :)
 
sbi
9:34 PM
@Xeo You might get away with asking a question on PSE whether there are any studies on the safety of code in different programming languages.
 
Ok, I think now I know what bank (that teacher that accidentally (gave my e-mail to their students a while back)) uses.
Why else would a bank I don't have an account with send me their newsletter?
 
@RMartinhoFernandes Wow, that's a complicated sentence.
 
Xeo
@sbi Ahahaha, nice idea
 
you couldn't cram a double negation into it too?
 
@FredOverflow LISPified.
 
Xeo
9:36 PM
@RMartinhoFernandes You're missing an all enclosing pair of parens
I think
 
also seven quotes and some dashes
 
A simple explanation about liveness of variables, ranger.uta.edu/~nystrom/courses/cse5317-sp10/lec/dfa1.pdf
 
@RMartinhoFernandes That's not lispified, that's using parentheses to override operator preference.
 
@StackedCrooked Parentheses = LISP. Shut up.
Silly Americans can't decide if they want piracy or not.
 
@RMartinhoFernandes I've never seen before that you actually saves a chick on your profile picture, good job!
 
9:48 PM
It's Altaira.
From the movie Forbidden Planet. And the robot is Robby the Robot.
 
The robot looks a bit more evil there!
 
He's good.
 
@ManofOneWay Now I see it too!
Never noticed.
 
Is it a good movie?
 
9:51 PM
@ManofOneWay It's amazing! (see the cover)
 
It's an old classic.
 
I'm watching the trailer now
 
I enjoyed it, but you have to keep in mind it's from the fifties.
 
sbi
This is a very disturbing, but also very educating analysis of the events that made the AF447 Airbus crash into the Pacific.
 
Leslie Nielsen is almost unrecognizable in that movie.
 
9:55 PM
Yeah.
 
badass special effects in that movie too
 
Well, if you enjoy old movies, I recommend it. If you don't, I don't want you to come back here complaining it sucks :)
 
sbi
Between the trailer and the lengths essay I linked to we've now successfully chased everybody away from flooding this room with messages. `:-\`
Amusing myself corrupting heap and stack with C-style strings (to prove something) and counting my blessings for all of std:: #GoingNative
 
@sbi I think you forgot to finish that smiley.
Oh, it's :-\ ?
 

« first day (418 days earlier)      last day (4531 days later) »