« first day (691 days earlier)      last day (4240 days later) » 

10:00 PM
Similar magic exists for 'indexable' properties - very nifty for enumerables; This works with the IEnumXXXXX interfaces
 
It means "waah lazy evaluation is not predictable in the exact manner I want waaah"
 
@TonyTheLion It means the OP is clueless about what lazy evaluation means.
 
lol
@JerryCoffin I see
 
@CatPlusPlus Huh. That actually makes sense. I didn't read it that way at all.
 
"Hope experts can shed a light on me" - classic — sehe 3 secs ago
 
10:00 PM
@Shog9 I have a gift.
Or a curse.
 
@Shog9 Me neither :)
 
Depends on your POV, I guess.
 
@sehe well that's IDispatch (IIRC the name correctly), and it's abstract data, accessed via calls.
 
@CatPlusPlus more of a curse really, understanding shitty questions can only be curse
 
@CatPlusPlus When Zacharias couldn't speak - it was called a blessing. But he was a high priest
 
10:01 PM
@CatPlusPlus You're busy shedding lights at an alarming rate. You should probably have that checked out.
 
@Cheersandhth.-Alf ? that's unrelated. Property IDs are in the IDL.
 
is he repwhoring?
 
My brain control light is blinking all my life.
 
@sehe check out how you access them ;-)
 
10:03 PM
@Cheersandhth.-Alf Well, the few languages that care about property IDs actually can work both ways. So it is really unrelated (FTR early or late bound)
 
I'm probably going crazier due to my awesome work project (TM).
 
I definitely remember property IDs being connected to IDispatch in some way. They were the only way to get some WSH stuff working, and that was all IDispatch.
 
@TonyTheLion What the hell are you doing on .
 
@Shog9 That's true. These languages obviously never early bound
 
@sehe No. In theory, they could cache information so you weren't supposed to, say, switch up what an ID meant at run time - but in practice you could get away with a lot of dodgy shit there too.
 
10:04 PM
@CatPlusPlus laughing :)
 
@TonyTheLion Reminds me of some of the 270kLOC PL/SQL code I recently rewrote into 27kLOC of C#
 
What.
 
@sehe oh god
PL/SQL is not my friend.
Oracle, ugh
 
@sehe you're quite wrong. i just mentioned that these kinds of properties come from IDispatch. which is the main interface for OLE Automation. sure tjhere's a zillion technical facts associated with that, including stuff that came later. but that is unrelated.
 
Mar 13 at 10:07, by sehe
@RMartinhoFernandes by the way, the code went down from 27k LOC in a single Oracle package (requiring external packages) to about 2.5k LoC in 31 classes.
@TonyTheLion I was off by an order of magnitude :) sorry ^^
 
10:06 PM
how did you even come out of that still sane ?
 
He didn't.
 
explains everything
 
I'm betting you couldn't even grasp 270k SLOC of PL/SQL, let alone write an equivalent in another language.
 
@Cheersandhth.-Alf I was pretty sure IDL, midl compiler and typelibs predate idispatch. Anyways, you're probably right, and it doesn't matter too much to me now.
 
@sehe They did, but they expanded the hell out of IDL to support IDispatch
 
10:07 PM
@Shog9 Attributes, yay!
 
Oh yeah, and then there was the whole attributed C++ which embedded IDL in your headers for fun and profit. I was quickly losing my enthusiasm for the whole thing by that point.
 
@CatPlusPlus Well, to be fair, it was crufty code: lot's of copy/paste in Oracle. So the bulk of the work was ironing all the duplicates out and strictly comparing for any deviations. Of which there were many that were latent bugs
@Shog9 I don't think many used that actively. I have certainly always preferred separate IDL, and then #import to get the headers.
Never really enjoyed COM (in C++). C++/CLR beats it by some margin. If you must do COM Interop, anyways
 
@Shog9 Which, for rather different reasons, they sort of continue today. msdn.microsoft.com/en-us/library/ms235402.aspx
 
I can't believe I set off a discussion about COM
 
SOMEONE SET US UP THE BOMB COM
MOVE ZIG
 
10:10 PM
#import (and the various support classes0 at least made it bearable. The whole thing finally came together pretty nicely about the time .NET launched, which is kinda sad but I guess made it maintainable.
 
You can enjoy COM?
 
Ell
how do you get people to switch from Skype to a hypothetical free as in money and open source equivalent?
 
You really are crazy.
 
@Shog9 Yeah. .NET is pretty win in the bridging department. And still getting better at it.
@CatPlusPlus misspelled?
@Ell you can't. Hypothetical isn't quite as much fun
 
@Ell Nobody probably cares.
Though you can spin "it has no damn ads" side.
I use Skype only for work, and it's terrible.
 
10:12 PM
@sehe beats stepping through the VB6 VM with a stick wondering who trashed the stack
 
I still remember with some fondness the bstr_t, variant_t wrappers. I could run circles around fellow programmers, simply avoiding the memory management and (string) conversions needed to get stuff across the C++/COM divide
 
VB6 is terrible.
 
@Shog9 Yay. And apartments. And the GIT. Freethreaded marshaler anyone... Oh the things I'm happy to forget
 
@sehe ...finding the reference leaks in MSDN examples, converting them to use smartpointers
 
10:14 PM
lol
 
@Shog9 You worked there? Or still do? Or did you contribute 'for free'?
 
@TonyTheLion Leave out the '6' and that remains at least as accurate.
 
@sehe Oh, no, I meant for my own use.
 
VB.NET isn't any better
 
10:14 PM
@TonyTheLion Pro tip: It was a language. Much like php. It sollicited poor programmers, but as a platform, it wasn't the worst. I'd say, php is probably worse
 
I hate writing End If explicitly
@sehe besides maybe Malbolge, PHP tops everything in being the worst
Malbolge is probably better than PHP
 
@Shog9 That way. I remember the MSDN samples always showed the 'hard' way (i.e. plain Win32 API calls, instead of the ATL/MFC helpers classes, which, incidentally were frequently header-only and just required oleaut.dll which is required anyway)
@TonyTheLion Malbolge is better then PHP, in that it is less easily abused (by bad prgrammers)
 
@TonyTheLion In the IDE, you didn't need to, IIRC. It would autocomplete.
 
@sehe it's still fugly
 
10:17 PM
@TonyTheLion Look at Zimbu, for ugly.
Or, PL/SQL for that matter :)
 
@sehe Which is reasonable, except when it went from 1-page examples of a single call to multi-file downloadable examples of an entire API, which you'd open to find they had implemented their own reference-tracking system that was only usable for the example and not very well there, but succeeded in making the code unusable as a reference without sitting down and tracing through the whole thing first.
 
@Shog9 Oh yeah, that's recognizable.
 
And so you're scratching your head wondering if the damn thing is keeping an object alive for the entire life of the program out of laziness, or because the API actually requires it.
 
FUNC MAIN() int
  IO.write("Hello, World!\n")
  RETURN 0
}
Zimbu ^
 
And after a day of testing, you realize that both are true, for different objects.
 
10:19 PM
@sehe I have experience there, meh
 
Last project I did like this involved Extended MAPI, which only works for Exchange anyway, is poorly documented, and presumably only exists for the sake of Outlook Express
 
Outlook Express is yuck
 
And now I know why ;-)
 
a desktop app for doing e-mail?
how 20th century
 
10:24 PM
I still use Outlook
 
@Shog9 Was indeed one of my last experiences with C++ and COM, I think. That was in 1999/2000, I guess. I used CDO, IIRC, which was built on MAPI. Is that what you mean?
 
My last experience with COM was an Internet Explorer toolbar in 2008 :)
 
I've always hated Outlook...
 
Nah, I just recall, I later wrapped a Biometrics device SDK for use in VB6... I wrote that in VC 2005 'Managed Extensions'. Which was a nice experience compared to the oldfashioned hand work
 
@Mysticial it's slow and bloated
but I can deal with it
@StackedCrooked oh god
 
10:26 PM
At work I'm using Thunderbird. It's so so..
 
@sehe No, Extended MAPI was the "successor" to MAPI, but implemented almost entirely differently and in a mostly incompatible fashion. It did let you get away with sending emails without that "spammer script" warning though.
 
Email protocol is borked
 
@StackedCrooked I'm using TB at home. I like it a lot. It is fast. The multiaccount options are great. The plugins are nice (ThreadVis FTW!) and the search is incredible. THe latter is the #1 feature of any MUA for me
 
I wonder if anyone is ever going to implement something better than SMTP
 
@TonyTheLion Breaking news
 
10:28 PM
lol
old news
 
@TonyTheLion Answer: no. For the same reason that everyone uses FB, allthough it shucks
 
@Shog9 Oh hey... what's the policy on deleting highly voted dupes? This question bothers me.
 
@Mysticial Policy is "don't delete". If the answers are good, merge.
Of course, that doesn't mean they don't get deleted, as that question ably demonstrates.
 
@TonyTheLion It's the old soldier that'll never die, just fade away.
 
10:31 PM
0
Q: c++ can't compile a file

M WI'm a beginner at c++ and I'm trying to write a program to find greatest common factor. In main i have: #include <iostream> #include <cstdlib> #include "longgcd.cpp" int main(int argc, char* argv[]){ long gcd(long m, long n); long m,n,g; m=atol(argv[1]); n=atol(argv[2]); g=...

oh god he's including a CPP file
 
@TonyTheLion happened before :)
 
The things I've included.
 
You wouldn't include a car, would you?
 
@CatPlusPlus oh, should I ask what?
 
you wouldn't #include a handbag?
 
10:33 PM
@Shog9 So would that question be worthy of a merge? It doesn't feel right that the top answer goes away just because the question is a dupe.
 
if it's a female programmer, she might
#include "handbag.h"
 
#include me
 
#include myaxe
 
include <kitchen_sink>
 
Nov 19 '11 at 15:27, by jalf
never ever include cpp files, that's just asking for trouble
Jun 26 at 15:57, by FredOverflow
@user1477622 If you include .cpp files, kittens die.
 
10:35 PM
@Mysticial Closed as a dup of another question closed as a dup. Which isn't a dup.
 
I wonder who came with the idea of having header files and cpp files
was it Bjarne?
 
Every question on SO is a dup.
 
@TonyTheLion No, it's lifted from C.
 
@Mysticial The problem is, if I just merge then the answer doesn't make any sense
 
10:35 PM
@CatPlusPlus what's the very question a dupe of?
@CatPlusPlus explains a lot
 
@TonyTheLion no, it was in general use at the time (early 1970's, late 1960's). C++ inherited that from C
 
@TonyTheLion The Question.
 
@Cheersandhth.-Alf right, and at the time was that a good thing because of some hardware constraint or what?
 
C++ inherited that from C, and C is a crappy language.
No, they wanted C compilers to be one-pass, hohum.
 
@TonyTheLion can't find the incident I was looking for. Oh well
 
10:37 PM
@Shog9 You're right. The only problem I see so far is that it uses different variable names. That top answer I think fits well into the dupe target (if we edit the names to x instead of y). It's arguably the best one.
 
That's why you have to declare everything.
Because we can't have symbol collection pass, no sir.
 
@CatPlusPlus If I recall correctly, it's not because they were jerks about it. It's because that was all machines at the time could do.
 
I declare: Peace
 
@Mysticial I like the background information. It's effectively the same as the top answer on the other one, but it's worth keeping for the background I think.
 
@Shog9 So can we do anything to save it?
 
10:38 PM
@DeadMG Machines at the time had no problem doing LISP and other fancy high-level stuff.
But then again, I don't care. I just wish C++ was scrapped and rebooted.
And then we'll have another D which nobody will use.
 
Small incremental improvements over decades is all you're gonna get.
 
Everything sucks in this industry.
 
@DeadMG well, other languages at the time, and before C!, had real modules. examples include Niklaus Wirth's first Modula, and I think also the Norwegian Simula (which strongly influenced Smalltalk and C++). and I seem to recall something about "Hoare envelopes" for initializing and cleaning up modules
 
It's not even funny.
 
@CatPlusPlus why don't you go do something completely different?
 
10:41 PM
Why am I doing this. Why couldn't I be dumb and doing sports instead.
 
like, build cars
 
@CatPlusPlus C was originally used on a machine that was already quite obsolete at the time. Even high end machines at the time had quite a bit of trouble running LISP too -- serious use of LISP was almost entirely on dedicated hardware (LISP Machines).
 
@CatPlusPlus you can still do sports instead, just pretend to be dumb
 
I can't, I find them exhausting and I don't like that.
 
ah
well, you could go fill racks in supermarket?
you don't need much braincells for that
 
10:42 PM
Yes, this is the career I always wanted.
Much better than programming.
 
lol
won't earn you as much though
 
Too bad it pays exactly the minimum wage.
 
my brother does that
he earns jack shit for all the hours he has to work
 
@Shog9 Ah I see what you did. I guess the system currently doesn't have a "selective" merge option.
 
Programming ain't that bad. You are zooming in too much on the aspects that you don't like.
 
10:44 PM
Sorry, all I can find about it is myself quoting private mail from Bjarne
But anyway here goes,
"Simula had the equivalent of one constructor (not several constructors) for a
class but no destructors. The idea of construction as creation of working
environment for class member functions (incl. resource acquisition) and
destruction as the inverse operation (incl. resource release) was fundamental to
and very early in C++ (1979). I knew Simula very well and was aware of Naur's
work on invariants (from the mid-1970), but I think the C++
constructor/destructor use and language facilities were original at the time."
 
Pascal had modules, too.
 
@Mysticial It... kinda does... But that would've made things even weirder by leaving a question sitting around without its top answer. Also this way the original question gets more link juice, meaning it'll be easier to find for future dup-closing. I hope.
 
@Cheersandhth.-Alf Modula did not predate C. C was roughly concurrent with Pascal, the predecessor of which was Algol-W (the predecessor of which was Algol-60). The preprocessor had several advantages over Pascal. For example, Pascal (at the time) didn't even have a way to include math in a constant (e.g., #define SIZE (16*1024).
 
I always forget which one was first.
 
@CatPlusPlus not the original jensen & wirth pascal. but ucsd pascal had (later)
 
10:45 PM
It's a good idea. But not entirely new, it basically models "stack semantics".
 
@JerryCoffin Pascal was Wirth's second language
 
Still better than C ever were.
 
hm wikipedia says i remember that wrong
 
@StackedCrooked Actual projects are exhausting.
The process sucks, the customers are bad and I have to deal with shitty code.
In subpar languages.
I foresee E/N meltdown in few years time.
 
10:48 PM
@Cheersandhth.-Alf More like fourth -- but Modula wasn't one of them. In case you care: Wirth was on the Algol committee, working on what eventually became Algol 68. He wrote a variant that came to be known as Algol-W, but the editor basically rejected it. Wirth then basically quit the committee and continued on his own (taking several influential members with him).
 
Dealing with customers is something I absolutely like to avoid. I like to hide in the lower layers.
 
@Shog9 I meant a partial merge that moves only selected answers and leaves the rest deleted on the original. But this works too. Thanks!
 
@CatPlusPlus E/N?
 
@Mysticial Yeah, that's sorta possible, but it doesn't leave any trace on the original question so... It kinda sucks for normal use.
With a normal merge, you get a link back that lets everyone know what happened.
(and a history record, etc.)
 
10:50 PM
There's more than one type of merge? I didn't know that.
 
@Mysticial Shog can correct me if I'm wrong, but I think it comes down to: the system supports one kind of merge, but if they want to badly enough, the mods can do other sorts of things by hand (cutting and pasting answers from one place to another, etc.)
 
@Mysticial There are, IIRC, three kinds of merges. One is the old "move answers, destroy source question with no record that it ever existed" merge - that's no longer used, but you'll occasionally find traces of it (identifiable by the mismatched timestamps on stuff). The other is the normal merge like what I just did. And the last is a dev-only "move answer to somewhere else" thing that, again, shouldn't normally be used because it doesn't keep records of what happened.
 
@Shog9 ah, that makes sense.
 
A fast question here. Can i get input from cin into 2 variables at the same time?
 
@MohamedAhmedNabil cin >> a >> b;
 
10:55 PM
@JerryCoffin That makes the user enter twice
 
@MohamedAhmedNabil That'll work fine with input like 1 2 <return>.
 
@JerryCoffin I was thinking of something differnt, I was thinking the user would enter the input once , and it would be stored into 2 variables
 
@MohamedAhmedNabil In that case, just enter one variable, and assign its value to the other afterwards: cin >> a; b = a;
 
user406009
@MohamedAhmedNabil You could have b be a reference to a;
 
user406009
int a;
int &b = a;
cin>>a;
 
10:58 PM
of course the electronics in a laptop wears out if it doesn't turn itself off after 15 minutes when it's on mains power. or...
i don't understand why it must turn itself off by default
 
@EthanSteinberg What about 2 different data types
 
and why there apparently is no option to say "no" to that, i just set to 100 hours was the best i could
 
you know
I'd never fit in in a normal workplace
I'd endlessly correct my boss about the mathematical impossibility of giving 110%
 
user406009
@MohamedAhmedNabil Then references will not work. Any specific reason why assignment(b = a) wont' work for you?
 
posted on September 06, 2012

One of the more effective ways of finding out that something doesn't work is to try to explain why you think it does work.

 
11:01 PM
I have got another question, assume the program prompts the uesr to enter 1 number but the user accidently hits white-space "5 1" The 5 will be taken in the first inupt operation and the second number will be taken in the one proceeding it, How can i make it so that the program only takes 5 and ignores the rest
 
user406009
Use getline.
 
@MohamedAhmedNabil Use getline to read the whole line of input, then put that into an std::istringstream and read the individual data item(s) from there. You can ignore the rest, or fail/retry if you find input that doesn't fit expectations.
 
@JerryCoffin ooooh, i didnt learn stringstream yet, thanks
 
@Cheersandhth.-Alf What OS is this on?
 
Question on std::future. I have a function that returns a std::future<Foo>. Sometimes computing the answer is expensive and so I return std::async(std::launch::deferred, []() { blah blah }), but sometimes I know the answer already and would like to return it eagerly. Is there a one-liner for converting a value of type Foo into an already-evaluated future of type std::future<Foo> ?
 
11:06 PM
@JerryCoffin windows 7. it's my new replacement laptop. for the one i spilled a cup of coffee in
 
The best I can come up with is: std::future<Foo> result = std::async(std::launch::deferred, []() { return MyValue; }); result.wait(); return result;
 
@Quuxplusone hi there. Please read the newbie hints when you are new here
 
Done.
 
@Quuxplusone You want to... memoize futures?
 
I wouldn't describe it that way.
 
11:07 PM
Just memoize a plain function, that only creates an async request if it wasn't cached
 
@Cheersandhth.-Alf Bring up the "power options" control panel. Click on "create a power plan" to the left. Choose "high performance" as the basis. Change "turn display off" to "never" and leave "put the computer to sleep" at "never". Click done.
 
@sehe I'd say, I want to return something that type-checks as a std::future, but in fact it's already stored the answer.
 
@Quuxplusone sounds like a design smell. And you're description matches my summary for me, at least
 
My "best I can come up with" does work, and I could wrap it up into a function futurize(MyValue), but I was kinda hoping this would already exist.
Okay. Yeah, it is similar to memoization, after all.
 
@JerryCoffin yes, thanks!, that's where i tried. it worked on old laptop. i think the manufacturer can sort of customize that thing. this is a samsung, old one was asus
 
11:10 PM
@Cheersandhth.-Alf How odd -- I've never heard of the "never" option being removed before. How odd.
 
@sehe It's not hard to get into this situation, though. The function that returns this future looks like "If (easy case) { return futurize(0); } else { return std::async(complicated stuff); }"
 
here is a practical joke taught to children by norwegian state television: take a suitably large piece of thin transparent plastic, stretch it across the toilet so it's invisible
he he
 
@Quuxplusone What's wrong with 'return std::async(foo, ....);` with foo(..) { if (easy) return 0; else return complicated_stuff(); }?
 
also, you can put chocolate spread in a dog-turd like formation on the ground, then when someone looks you put a finger in, scoop up some and taste it
 
@Cheersandhth.-Alf What are you watching.
 
11:12 PM
children's television
 
The check for "if (easy)" isn't trivial. :)
 
for norwegian children
i think maybe this is part of why we are as we are
 
@sehe Besides, pushing the "if" inside the std::async indents everything an extra two levels, which is ugly and smelly IMHO. Yes, I'm over-using lambdas.
 
my father told of how when they were children, they painted the windows of some guy's house black, so that he overslept (thought it was still night)
there's also this trick where you fasten a string to a window pane with some gum or something, and then you can be far away rubbing something against the string to produce an infernal sound inside the window
 
Ah saw it
 
11:15 PM
Yep. :)
 
well ok i shouldn't be giving you guys ideas
 
@Quuxplusone Well it the check isn't trivial, all the more reason to include it in the 'action'
 
@Cheersandhth.-Alf yeah, I'mma paint your window black tonight!
 
11:17 PM
What is the best C++ IDE ever?
 
@sehe Well, you might have a point... or at least it might not be worth trying to do half the work up front and deferring the second half. I might as well defer it all.
But in practice I just wrote up a function std::future<void> already_computed(void) and I'm returning that all over the place now. ;p
 
anyone here use asio?
 
@Quuxplusone If you care for some real discussion, post it on Stack Overflow or codereview.stackexchange.com. If you drop a link, I'd point some of the regulars to it. Some of them may find this interesting :)
(Hint: I don't really. It feels like being clever for the sake of not having to change calling code. I think it always pays to be explicit/verbose and simple. Only complicate/hide when you need the optimization)
 
@sehe I came here because it doesn't feel like a question that would get useful answers on SO. But I didn't know that codereview.stackexchange.com existed. I might clean it up and post there.
 
11:33 PM
foo(std::vector<double>&r){

int len;

len = r.size(); //error value required as left operand of assignment

}
how come the above fails?
 
@pyCthon it doesn't, it's a trick question.
 
int len = (int)r.size(); worked for me
 
@pyCthon oh, foo has no return type
@pyCthon ideone.com/xkmeq works fine
 
yeah maybe old compiler 4.1.2 gcc....
 
@MohamedAhmedNabil They all have pros and cons. Visual Studio is very buggy, but has the best debugger, and is easy to use. Go figure.
@pyCthon should work on old versions too, that test was on 4.3.4
@pyCthon the closest error I know to that one is "lvalue" required as left operand...
which means that the left side was the result of an expression, and wasn't a variable.
like "3 + 4 = r.size()" would give that error.
 
11:43 PM
ah i found it!
my partner added #define N 8192 in a macro
to the header file..
causing the error you were right it does work
 
@pyCthon and you had a variable named N?
@pyCthon I know :D
@pyCthon both of you had variables named N?
 
yeah...
 
@pyCthon name your variables better
also, namespaces, and don't use macros.
 
yeah we used N as the length every array should be
 
array_len
bah, it's frustrating when an answer has multiple wrong answers, and so I post a correct answer, and nobody scrolls down far enough to upvote my answer :(
 
11:48 PM
i love find+ replace lol
yeah thats happened to me a few times
 
@pyCthon Always listen to @MooingDuck , He is wise ^.^
 
wise? hardly
 
@MooingDuck The force is strong with you.
 
does it sound out of the ordinary for /usr/local/lib to not be in the library search path?
it does to me
 
@vedosity I don't know linux, but that seems odd
 
11:51 PM
but nonetheless, I had to add it to the search paths. I'm using Xcode 4.4.1
on mac os x
 
is it lib64 only?
opt/local/lib then
on mac no?
 
@MooingDuck What do you think of code::block
 
@pyCthon Mountain Lion doesn't run 64 bit binaries
 
@MohamedAhmedNabil never used it
 
@MooingDuck What do you use?
 
11:53 PM
@MohamedAhmedNabil mostly Visual Studio, with small amounts of notepad, vim, gcc, clang, and netbeans.
 
@pyCthon I suspect a macro. Try #undef len just before function foo?
 
@sehe wow, now that is impressive. or cheating. one of the two.
@pyCthon and global constants rather than defines.
 
@MooingDuck Hah. It was resolved already. Yeah, well, like you said it was a trick question: the code was right there.
Anytime code doesn't do what it obviously should, I suspect (Microsoft) evil Macros.
 
ah wtf, "libc++abi.dylib: terminate called without an active exception", debugger says this happens on the closing brace of main() :/
 
Experience.
 
11:56 PM
lol
i avoid macros like the plague , even boost_foreach is buggy as hell full of macros great idea thou...
 
@vedosity Yeah, I always expect it to be, but it clearly isn't on the default lib search path in my distribution. So, realistically, I think it's by design. Nothing you can't override, of course
@vedosity IOW: I recognize the issue. I've been there. I was surprised. I have learned to no longer be surprised at that :)
 
Yeah. I'll just complain a little :)
 

« first day (691 days earlier)      last day (4240 days later) »