« first day (417 days earlier)      last day (4516 days later) » 

7:08 AM
Oh no, not multidimensional arrays again...
0
Q: Anything instead of multidimensional arrays?

arjacsohSince vectors are preferred to arrays in C++, I would like to ask what kind of structure you suggest generally in case one wants to store data in a multidimensional array form (m rows, n columns). Vector of vectors is a reasonable and effective practice?

We should have a std::matrix just for these questions.
 
7:50 AM
oh
 
Xeo
8:20 AM
Wow. Boost.MultiArray abuses operator overloading the hard way..
a_range = 0 <= range().stride(2) < 4;
a_range = 0 <= range().stride(2) <= 3;
 
Ugh.
@Xeo "Did you even read the link I provided?" Did you? – curiousguy 3 hours ago
Have you seen this?
 
Xeo
Yeah, but I don't want to deal with it, as I specifically mentioned the first sentence being important as to why pass shared_ptrs by value
 
hey fellas, what's the current feeling on pimpl in c++?
and is it more awesome with c++11? I don't know about perfect forwarding, but it sounds like a maybe.
 
8:36 AM
No idea why it'd change.
 
well, if I didn't know what it was to begin with, maybe you could help me out.
 
You only get to use perfect forwarding with a template, and that's incompatible with pimpl.
 
I also don't know if you're referring to the first line or the second.
another case of illiteracy catching up with me
 
You know what pimpl is?
 
yeah, just never actually used it, didn't really have the need
 
8:39 AM
Ok. And perfect forwarding?
 
not at all. it just sounds cool.
figured it had something to do with email. :)
 
Well, you know that now you can overload depending on whether the arguments are rvalues or lvalues?
 
yessir
 
Ok, now imagine I have a function with three parameters.
 
I have thusly imagined
 
8:42 AM
mawning
 
All that function does is pass those parameters to some constructor.
Think like make_pair.
 
okay
 
Let's that the function f. If I call f(Foo(), x, Bar());, I'm passing an rvalue, an lvalue, and another rvalue.
 
uh-huh
 
I want f to call the constructor passing exactly the same kind of values: an rvalue for the first, lvalue for the second, and so on.
 
8:44 AM
go on
 
perfect forwarding
 
Because the constructor may be overloaded to do different things depending on that.
 
ok, I'm having strange linker errors
private: static class std::codecvt<unsigned short,char,int> const * & __cdecl boost::filesystem3::path::wchar_t_codecvt_facet(void)" (?wchar_t_codecvt_facet@path@filesystem3@boost@@CAAAPBV?$codecvt@GDH@std@@XZ) referenced in function "public: static class std::codecvt<unsigned short,char,int> const & __cdecl boost::filesystem3::path::codecvt(void)" (?codecvt@path@filesystem3@boost@@SAABV?$codecvt@GDH@std@@XZ)
 
One solution would involve overloading f for each combination or lvalue/rvalue arguments.
That would mean 8 overloads.
That's a lot.
 
and increases if you want more
 
8:46 AM
oh hai
 
arguments
hai
 
you want an argument?
 
With perfect forwarding you can do that with a simple templated definition.
 
a function argument
 
oh....
 
8:47 AM
sweet
 
if I want a regular argument, I'll just attempt to convince VS that it wants to compile my code
 
looks like Tony is already there
 
The basic pattern is template <typename Arg> void f(Arg&& arg) { ctor(std::forward<Arg>(arg)).
If you need more arguments, you just add them to this, using the same pattern, and there's no need for a bazillion overloads.
 
@DeadMG I'm attempting the same thing
and it's not working :(
 
or even more than one, if you add varadic templates
 
8:48 AM
stupid linker
 
looks to me like you forgot to get the boost filesystem static lib
 
boost.locale?
 
@DeadMG hmmm
 
Combined with variadic arguments you can easily have make factory functions with just a few ellipses thrown in: template <typename... Arg> void f(Arg&&... arg) { ctor(std::forward<Arg>(arg)...)
rvalue references and std::forward do the magic of maintaining the somethingvalue-ness of the arguments.
(What's a decent name for somethingvalue-ness?)
 
does that make the abstract base class / factory technique more viable?
 
8:51 AM
value category, I believe it is
 
Right, that.
@keithlayne Not sure what you're talking about.
 
so on the first question, is pimpl considered awesome or not so much?
never mind the other question
 
Pimpl is still useful in the same way it was before. Helps with compilation times, mostly.
 
PIMPL sucks
 
Also lets you keep more #includes out of headers.
@DeadMG It's an ugly workaround for the ugly compilation model.
 
8:56 AM
true
all I'm really seeing there is "ugly, ugly"
 
I was reading somewhere recommending that the pimpl mirror the public interface. I wouldn't do it that way I think.
then I couldn't really call it pimpl I think.
 
also
 
"pimpl" -> "public implementation"
:P
 
your mother's an ugly workaround
 
8:58 AM
s/public/private/ ?
 
this is an Official Fact™
 
@keithlayne Sure, but I was hinting that you could still call it pimpl, by changing what the p means.
ARRRGh.
 
I was thinking more pprivatedatathaticandowithasiplease
 
You guys have been using C++ for years. How come you were not driven insane by this sea of people miserably failing their attempts to use 2D arrays?
 
because I stopped answering questions
 
9:01 AM
because it's not that hard even if you actually use 2d arrays
 
@DeadMG Liar! I saw you answer one Monday, or something.
 
yeah
 
Because I don't use them much myself - so I don't really know either... lolz
 
I do answer like, one or two in a day
 
I guess it was better back in the day when you actually had to do your own homework.
 
9:02 AM
Yes, I can handle them. But I don't use them either.
What annoys me is that every day there are three new "How do I something 2D arrays in C++?" questions.
 
I'm fine with pointers to pointers... (double**)
but when you start mixing * with [] or [][]
 
oh, I see
 
and if you were that clueless you were bound to fail and move on to psychology or some other nonsense
 
you're a two-star programmer, are you?
 
then I'm just as messed up underneath
so I avoid them
and always stick with **
@DeadMG If that's how you define it, then yeah. :)
 
9:03 AM
the saner, more competent C++ programmers tend to use less stars
 
FTR, the good thing is being a one-star programmer.
 
and you never see any [] types
 
I think SO is inadvertently pushing up CS graduation rates for the worse
3
 
unless it's real quick and dirty, I guess
 
or for the better for people who don't suck
 
9:04 AM
@DeadMG I use a [] type on argv. That's it.
Force of habit. char* argv[].
 
char **argv is much awesomer
 
I changed mine to call a real_main(std::vector<string> args)
 
@keithlayne lol
 
@DeadMG I've added all the boost filesystem libs I could find
 
You still need to hide the argv somewhere.
 
9:06 AM
not sure what a static lib is?
 
it's a non-dynamic lib
 
so I have something like int _wmain(int size, wchar_t* argv[]) { return real_main(std::vector<string>(argv, argv + size)); }
but if I really wanted to
and in the future I might well do
 
@TonyTheLion It's one of those that ends in .lib. It gets bundled into the final executable instead of kept in a separate dll.
 
is use the Windows function GetCommandLineW()
and then I can just have int main()
 
@DeadMG Doesn't match what you said earlier! real_main takes only one argument.
 
9:07 AM
@RMartinhoFernandes well, I've included those, doesn't solve my linker error
 
@keithlayne:O
 
@tony is it actually linking with said libs?
 
@keithlayne hmmm. how would you check that?
 
but if I was desperate, I'd use GetCommandLineW()
 
I'm no VS guy, but you need to set linker options somewhere
maybe something like nm | grep for windows
I know that probably isn't helpful
 
9:09 AM
I'd list the options out now, but now is one the few times where I have matlab and mathematica open instead of Visual Studio...
 
I'm a baus
 
but if it fails to find the definition at link, then they're surely not linked
 
Xeo
@DeadMG Close YT now.
 
@DeadMG Don't tell me you're still listening to that.
 
lol
 
9:10 AM
@Mysticial do you know how long mathematica has been around?
 
since like 1980 something?
 
Since some dudes that died long ago.
 
1989 maybe?
 
@RMartinhoFernandes Technically, I rotated around a few others and came back to that one just now
 
I've been using it since middle school... made school soooo much easier...
 
9:12 AM
@Mysticial wiki says 1988. that's crazy. It was pretty awesome even then. you must have gone to a rich school if they could afford that.
 
@keithlayne You were pretty awesome even then?
 
yes, as was Mathematica
 
Nope, I was always one of the only students who used it from middle school all the way until even now...
I learned it from my Dad.
 
My dad taught me sports. Which one was more valuable, I wonder...
 
It was one of those things that made homework doable in 5 min...
 
9:15 AM
I've been programming since 1993
which is pretty ballsy considering that I was only born in late 1990
 
matlab is awesome too, but octave is not bad
 
@DeadMG so basically since you were about 3 years old?
 
sure
 
9:16 AM
it was QBasic with DOS
 
Look where it got him.
 
When I entered college, a lot of classes did everything in Matlab. Derive this in matlab, plot this in matlab, etc... It would usually take like hundreds of lines. In Mathematica, it would take like 1 line...
 
@RMartinhoFernandes yea lol
 
I successfully implemented a program that would insult you if you were a sibling of mine
 
And it amazed me at how under-rated Mathematica was, and still is
 
9:17 AM
it was about 10 lines and made great use of GOTO
 
@DeadMG hahah
 
@Mysticial That doesn't mean the program was better- if the Mathematica program ran 100 times slower...
that was about it
 
They were homework problems...
 
@Mysticial I think the main factor with mathematica is the cost of entry. Maybe it's better now.
I always thought of the two as having different target audiences, maybe I was wrong
 
Probably. I use Mathematica like just as a calculator on steroids. Any sort of real programming still goes to Matlab. Anything HPC goes to C/C++.
 
9:20 AM
you own both?
 
> unresolved external symbol
is this the same as "i can't find the definition"?
 
Student versions are cheap
 
@tony pretty much
 
the ones my Dad gets for free from his work are also "cheap".
 
@TonyTheLion yes
 
9:20 AM
Damn. In my time, we used pencil-and-paper for that shit.
I'm only 24, dammit.
 
same as if it were looking for the def in any other compilation unit and couldn't find it.
 
my student version of Visual Studio is extremely cheap
 
I find it awesome that we can store knowledge and do computation by pushing graphite against cellulose.
 
no, it only stores knowledge
the human brain does the computation
 
or rubbing brain cells together
 
9:22 AM
@DeadMG It uses the paper as memory.
Like RAM.
 
it still amazes me how much computer power is needed to do, for example, computer vision
but humans need external storage to add two ten-digit numbers
 
@DeadMG And how many noobs, too.
 
haha true
 
@DeadMG That's just you.
 
right now?
 
9:22 AM
hmmm
 
actually, I personally can probably go up to quite a few digits
but it's been a while
 
I've included all the .lib files, I don't know what else could be wrong
for it not to find the defintion
of these two functions
 
@DeadMG What I find interesting is that, even if I could do it in my head, using external storage would actually make it faster.
 
well, the human brain is obviously more of a GPU than a CPU
very good at what it's very good at, and downright shitmobile at everything else
lots of functions implemented in hardware
 
9:24 AM
"shitmobile"? WTF.
 
0
Q: tough java questions (similar to tough C questions in k&r)

VaibhavIs there a book or an online source, which has tough java questions. I'm looking on a level similar to the C questions in "The C programming language" by Kernighan and Ritchie. Regards

lol
caught by the mod...
 
GPU: General Processing Unit :P
 
roflcakes
 
lolcopters
 
bitchcakes
wait, I sense a theme here
 
no
 
Who the heck came up with this idea?
 
no idea
 
donno, but I think it's funny
 
@tony you compiled the boost libs yourself?
 
9:29 AM
@keithlayne yes
lolympics :P
 
Morning
 
damn oneboxing
:(
 
could it have to do with the compile settings? Is that the only error?
 
@TonyTheLion Lolling at fencing!
 
9:31 AM
Makes perfect sense.
 
@keithlayne two errors
 
But it would be better if it was curling.
 
@TonyTheLion does it actually find the .libs successfully?
afaik if you tell it to link a .lib that doesn't exist, it's just ignored
 
error LNK2019: unresolved external symbol "private: static class std::codecvt<unsigned short,char,int> const * & __cdecl boost::filesystem3::path::wchar_t_codecvt_facet(void)" (?wchar_t_codecvt_facet@path@filesystem3@boost@@CAAAPBV?$codecvt@GDH@std@@XZ) referenced in function "public: static class std::codecvt<unsigned short,char,int> const & __cdecl boost::filesystem3::path::codecvt(void)" (?codecvt@path@filesystem3@boost@@SAABV?$codecvt@GDH@std@@XZ)
  error LNK2019: unresolved external symbol "void __cdecl boost::filesystem3::path_traits::convert(char const *,char const *,class std::basic
lol
hmmm
 
wow I wish it would leave out the mangled names
 
9:33 AM
yea would make it easier
 
that's not a manly decorated name
1> Function=FSM::or<FSM::or<FSM::or<FSM::or<FSM::or<FSM::action<FSM::or<FSM::or<FSM::or<FSM::or<FSM::or<FSM::equality_rule<wchar_t>,FSM::equality_rule<wchar_t>>,FSM::equality_rule<wchar_t>>,FSM::equality_rule<wchar_t>>,FSM::and<FSM::and<FSM::equality_rule<wchar_t>,FSM::equality_rule<wchar_t>>,FSM::zero_or_more<FSM::and<FSM::not<FSM::and<FSM::equality_rule<wchar_t>,FSM::equality_rule<wchar_t>>>,FSM::eps_parser>>>>,FSM::and<FSM::and<FSM::equality_rule<wchar_t>,FSM::equality_rule<wchar_t>>,FSM::zero_or_more<FSM::and<FSM::not<FSM::equality_rule<wchar_t>>,FSM::eps_parser>>>>,Wide::`
 
@tony which compiler? VS10?
 
that's a decorated name
 
@keithlayne no, vs2008
@jalf tried that, it's not ignoring it, it complained when I added something nonexistant
 
did you see this?
not sure it would help, still looking
 
9:36 AM
@DeadMG Add some recursive boost::variants in there and you'll see how fun it gets.
 
lol
 
@DeadMG how do you get an error of that size?
 
> Changes were made; the primary change was the addition of a trio of new project managers. That was their title, in any case. The three women hired to fill the role had no PM experience, no software experience, and knew nothing about the company or the projects they were going to work on. But they were all attractive to Stephan and they did understand time-sheets, so they focused on their core competencies.
 
use expression templates to construct a lexer
 
oh ghosh
 
9:38 AM
the type represents the function eventually constructed
 
It's an AST encoded as type information.
 
abstract syntax tree
 
Sounds like a problem with your Boost libs then, if I had to guess.
did you build static or dynamic libs?
 
9:40 AM
what is the view on basically re-writing questions entirely in order to clean them up and greatly improve the quality? I think it was a wise move... it's done now, but just curious what you make of such an action
 
@tony the link supposedly solved the problem for someone using vs2008, but they didn't specify the exact answer
 
@thecoshman when in doubt, respect the author, imo
it's better to leave a question unclear than changing its meaning or pissing off the author
IMO anyway
 
@tony you're not using qt, are you? that's where I'm finding references to that problem.
 
@jalf I am the author :P
 
@jalf did you ever get to see the cookie monster video? It's a classic.
 
9:44 AM
I wasn't sure if people preferred a question with lots of edits tagged on, or just to have it redone from scratch so that it is a lot more concise (that's what I aimed for at least)
 
it's your question, do what cha wanna do
 
Just don't make the existing answers look like rabid piles of nonsense.
 
@thecoshman if it's yours, edit away, as long as the question you're trying to ask is the same
 
that's what I figured :D
 
if you've got sensible answers, then you probably asked something different than you intended, so leave it and ask a new question
 
9:48 AM
only got the one answer... but it was mostly that the code in question had changed a fair bit but I was still having the same problem
 
@keithlayne I am using Qt
 
any luck with the link?
 
trying it now
@keithlayne yes it worked! I don't get why that makes a difference?
 
@tony magic, of course
 
10:03 AM
@TonyTheLion ooh, of course
look at the error you got. It referred to template types specailized for unsigned short rather than wchar_t. And if Boost was built with wchar_t as a distinct type, it'll have generated different mangled names
so the names you're looking for don't match the ones exported by Boost
 
Ugh.
Isn't wchar_t supposed to be distinct anyway?
Doesn't MSVC do so?
 
31 mins ago, by keith.layne
http://msdn.microsoft.com/en-us/library/dh8che7s?ppud=4
 
@RMartinhoFernandes Are you indian?
 
No.
Does C need const for this: char* x = "Blah";?
 
10:21 AM
I don't think it can be enforced by the spec because that would severely break backwards compatibility.
 
@RMartinhoFernandes it is suposed to, and it is by default in MSVC, but they have a backwards compatibility option to treat it as unsigned short
 
@RMartinhoFernandes No
 
@StackedCrooked Hmm, yeah, seems so. char s[] = "abc" this is an example from the spec.
That's cool then, I can fix my answer without explaining const.
 
they have the same exception as C++ I think
 
49
A: Is there a word for a non-geek?

Vincent MalgratLayman could be used to describe someone who is "untrained or lacks knowledge of a subject".

See second comment.
 
10:31 AM
I have 960 unread emails
 
"Select All, Mark as Read". Solved.
 
lol
most of them will be the university begging me for attention
 
@DeadMG The first thing you want to do is delete any marked "high priority" or with "URGENT" in the subject
 
lol
the thing is, I desperately want to tell them where to fucking shove it
but I need a degree
 
"Shove it <insert name of place where you want them to shove it>. And give me a degree". Hit Send, and voilá! All your current problems are gone.
 
10:37 AM
lol
 
Ha! You answered a question!
0
A: Splitting long method mantaining class interface

DeadMGThere is no problem here. The name mangling of Foo::doSomething() is always the same regardless of it's implementation.

 
true true
caught me, you have
 
"Liar!" is a science fiction short story by American writer Isaac Asimov. It first appeared in the May 1941 issue of Astounding Science Fiction and was reprinted in the collections I, Robot (1950) and The Complete Robot (1982). It was Asimov's third published positronic robot story. Although the word "robot" was introduced to the public by Czech writer Karel Čapek in his 1920 play R.U.R. (Rossum's Universal Robots), Asimov's story "Liar!" contains the first recorded use of the word "robotics" according to the Oxford English Dictionary. In 1969 "Liar" was adapted into an episode of the...
 
10:52 AM
Shit just got real... actually doing stuff at work now... taken so long... I don't know shit :(
 
11:06 AM
can anyone tell me good graphics libraries for turbo c++ ....our school unfortunately uses it and we have to develop with that .... i cant seem to get as to how to install SDL graphics library into turboc++ the linker settings and stuff
 
you'd be lucky
 
lol i know...this turboc++ is breaking my head off...they dont let us use dev or something decent ...sheesh...and the educational system is working (right!)
 
Xeo
Interesting that an instantiated template is called a template specialization in the standard
 
@Xeo It's always been.
What we call specializations are explicit specializations.
 
Xeo
11:15 AM
Yeah, but I didn't know that
or partial
 
We, programmers, overload every freaking term.
 
Xeo
we even overload "overload"
meta-overloading, so to speak
And I just found the place in the standard where all possible triggers of SFINAE are gathered
 
well there are so many terms that we need to use
if we didn't overload, we'd be down to calling things the "a1eb45f08912a" technique
 
yay
I happened on a much easier, more coherent explanation of my compiler implementation
 
Xeo
11:26 AM
You happened what?
 
I invented it
so when I am called upon to explain my great invention, it'll be easier
 
I wondered, what does the decl in decltype or declspec stand for?
 
Declothing, i.e, stripping.
 
declawing
 
11:34 AM
stripping has two ps
I believe that it's for declare
as in, declare the type of ( ... )
 
@DeadMG But I was talking about "the act of making stripes".
Obviously.
 
I see
 
I just got paid $2,390.73 for 4 days of travel 2 months ago. Christmas comes after all.
 
11:37 AM
still owed like $20k which will support my bumming for a while when that arrives
 
and I've worked like 4 days in the last 3 months
 
bumming?
 
if only it would last forever
 
you mean slacking?
 
11:43 AM
yep
 
lol
user image
2
I'm sure someone is guilty of this in this room.
 
usually me at my own posts :(
 
If you can't tell without looking at keyboard, you're doing it wrong.
 
Exactly. Who the heck looks at the keyboard?
 
11:53 AM
I don't, but I know people that do
lulz
 
They should be using the nipples.
 
¬_¬ @cat can I pester you with openGL again... I will stop soon... I promise...
 
I seem to have attracted a stalker :-(
 
@KerrekSB Don't worry, he stalks everyone.
 
he's just curious is all
 
11:55 AM
@thecoshman "Conflict of interests? I have interest in conflict!"
 
@KerrekSB interesting...
 
@thecoshman (That's from Command & Conquer, I should add.)
 
@KerrekSB How can you appreciate fiction?
 
@KerrekSB tottaly over my head
 
@RMartinhoFernandes How do you mean? Easily, with a glass of whisky?
 
Xeo
11:57 AM
@KerrekSB Oh, I seem to have that bug to. :P
 
I meant, how can you appreciate fiction without conflict?
 
@Xeo Maybe it's something about the way we smell? I don't know. This is like months later...
 
I like to type my comments in italics followed by douchebaggery in plain text.
5
 
@RMartinhoFernandes Oh. Conflict in fiction is fine. SO isn't entirely fictitious, though, is it? Are all those questions just in my head?!
 
Xeo
@keithlayne Where that douchbaggery is without an explanation, mostly it's just "no you can't", not the why.
 
11:59 AM
My therapist told me I shouldn't pick up Java...
@keithlayne Hehe, astute.
 

« first day (417 days earlier)      last day (4516 days later) »