« first day (304 days earlier)      last day (4870 days later) » 

00:15
@DeadMG I see. I think void* works for the first. The latter might be a wchar_t*...
Or a BSTR, say. It's not a 1-to-1 relationship. It's very long since I did any of that stuff.
@AlfPSteinbach Oh... how would one find out? I'm using Reflector to analyze a C# program, which ships with a native DLL.
You need documentation of the DLL
So I know which DLL function is being called, but all I have is its C# signature, not its native signature.
if it's a COM thing then perhaps there's a type library inside
00:20
Would a disassembly do? :-)
you can check with OLE/COM viewer
It might just be a native library. Where's the COM viewer, though?
uhm, bundled with visual studio professional?
Ugh.
:-S How about WinDbg?
he he
what's the C# declaration?
00:21
OK, no worries, I can do trial and error. How do I make a BSTR?
[DllImport("xxx.dll", CallingConvention=CallingConvention.Cdecl, CharSet=CharSet.Unicode)]
private static extern bool xxx_function(IntPtr ptr, string path);
it's the same as a wchar_t* zero-terminated string, except there's a 16-bit length BEFORE the char you have pointer to
that sure looks like wchar_t const*
the mangled name can tell you more I think
in my opinion, when you have 1 and 2 of a movie series, then 3 should be freely available on the net
@AlfPSteinbach ???
@AlfPSteinbach Does the BSTR also have a null terminator?
I think so, check out windows API SysAllocStr & family
I can just rig one up as a wchar_t[] with an extra element at the front, non?
00:28
Does the size prefix include the terminator?
No worries. Trial and error is the fastest!
It came from visual basic, and was adopted for OLE Automation (the IDispatch interface, & the Variant type). So this is one piece of Visual Basic in the Windows API. There are some other pieces in the scripting support. That Visual Basic is truly dead, no longer supported. But pieces of it live on...
I think BSTR is the default string in COM.
I see. that's good to know.
00:33
The default marshalling for strings is "A pointer to a null-terminated array of platform-dependent characters."
@RMartinhoFernandes Oh, thanks!
So I guess it's a regular C char*.
@KerrekSB I knew that page was buried somewhere within MSDN because I've been there before, but it took me a while to find it again.
MSDN search sucks.
@RMartinhoFernandes Hehe, it actually does!
Oh, and it's const, because .NET strings are immutable.
@RMartinhoFernandes Yes, I see. That doesn't affect the signature, though...
00:58
but what's a "platform dependent" character
Isn't that what char is all about?
in *nix yes. in Windows might be wchar_t. I don't know what they mean by that phrase
Hmm. An LPTSTR is "An LPWSTR if UNICODE is defined, an LPSTR otherwise."
Damn.
It's probably wchar_t then (assuming Windows here).
Or not.
I'm confused.
Yeah, I watched it a few times.
And for clarity, it was not a reality show.
It was a satire, with a script and all.
01:16
Damn it was fake? :(
Yes.
Before it aired was promoted as a reality show, but it turned out to be a great idea instead.
The guy in green that you see in the video offering the tea was the writer.
01:31
quite a discussion going on...
hello everybody
Hi.
I didn't knew the India had a homeopathy department. indianexpress.com/news/…
Isn't it like 2:35am in pt?
Yes, it is.
Oh, apparently, the UK has something like it too.
:(
> Espanha: a homeopatia é reconhecida como especialidade médica, sendo ensinada nas universidades de Sevilha, Valladolid, Múrcia, Barcelona, Bilbao e Málaga.
In Spain it's a medical specialty, taught in universities.
I'm baffled.
In dia too there are degerees in universities BHMS or somthing like that i guess
in india too....
 
2 hours later…
03:17
At work they said to me no STL and no Boost. We're targeting Windows, Linux, OS X and other future OSes we don't even know about yet; we can't depend on these (unportable) third party libraries.
I was like. I can't. It won't. There's. Not. Even. What.
I'm keeping my mouth shut and follow the rules. But it hurts. :(
They have interesting definitions of "unportable" and "third party"
I know. :(
user457812
A standard library is 'unportable'? O_o
03:55
@wilhelmtell: I suspect that the reason you were given was not the real reason. Instead, manager probably wants code that is "a better C", not that newfangled impossible to understand full C++. Small parts of the code can then be understood by certain employees, or perhaps even by manager himself; employees or temp hires who can understand parts of C-like code are probably mucho cheaper than C++ experts.
 
2 hours later…
05:50
@wilhelmtell In the 90's this was common. But we're 2011 now ...
 
1 hour later…
07:04
0
Q: how to insert data into std::map and show data from std::map in vc6

user859974i am using vc6. what is wrong in code below, i cant find out: std::map<int, std::vector<int> > myTemplate; //append data to map int temp=0; for (int i=0;i<=5;i++) { std::vector<int> tempVector; temp+=111; tempVector.push_back(temp); std::pair<int, std::v...

There is comment below the question: It's true, but its still the best IDE that MS have released. All versions released since are inferior. – john
WTF?! Where does the nonsense about VC6 being the best IDE come from?
Somebody please explain this to me.
@john: a great many people share that sentiment, that DevStudio 6.0 was the best MS IDE. It had to do, I think, with the downhill trend after 6.0, where the IDE to a much larger degree was made by idiots for idiots, and therefore e.g. incorporated ideas about knowing better than the programmer. Lemme fix that for you. It's incredibly annoying when you, for example, write formally correct XML and the ph*cking IDE "corrects" it for you. 6.0 only trashed image files, not more.
07:21
@wilx Simple: it's not even close to nonsense at all. The only real room for argument about VC6 being less than the best, would be to argue in favor of VC5 or possibly VC4.2b.
If you really think it's nonsense, consider writing a really good answer to one of my (old) questions:
5
Q: Can I create a simple DB browser with VS 2010 like I could with VS 6?

Jerry CoffinHaving recently installed the beta of VS 2010, I'm curious whether anybody knows how to get it to do something that was quite straightforward with VS 6. To create a simple database browser in VS 6, you could create an MFC application using a database view, connected to (for example an ODBC connec...

lol
Is that really all that makes it better?
For me, the fact that I can customize the layout a lot more is much more important. That is what makes the VS 2005 and later IDEs better.
@wilx All that makes it better? No, not even close -- just one example of something I really miss in the newer imitations.
What else.
@wilx: I think you've summed it up when you state that what's important to you is how it looks (customize the layout).
The real question is pretty simple: are you interested primarily on something where you can get a pretty screen layout while you're programming, or in something that helps you produce better programs?
07:30
Well, that makes me produce better code :)
Heh.
The editor is IMHO better as well, especially in VS 2010.
The visual cues are important to me for better orientation.
Also, while not optimal, the IntelliSense works a lot better than in VC6.
@wilx Hmm...I have to guess your vision isn't very good then -- like all WPF-based text, it has some rather serious problems with not drawing fonts correctly. The older versions were even worse, but even in VS 2010, it's still not quite right.
@wilx If you subject yourself to the stock Intellisense, you deserve all the problems you get. Whole Tomato FTW.
Yes, but that is a add on that I cannot/do not want to buy.
Compared to bare VC6, it is awesome.
Solution folders.
Debugger.
@wilx Then you might as well just program in edlin. Bare VC++ (regardless of version) isn't much better (and edlin is cheaper...)
Well, we are arguing about VC6 vs VS 2010, are we not? Or are we arguing about VC6 + 3rd party add ons vs bare VS 2010??
08:08
@wilx I thought we were discussing what was the best IDE overall.
08:44
@JerryCoffin seems to depend a lot on the monitor, from what I've seen. It looks fine on my machine, but I've seen some where it was pretty awful
why is it when I put my templates in a namespace, the compiler complains it cannot find anything that I use from the std namespace? I don't get it
@TonyTheTiger because you're doing something wrong, I'm betting
namespace srt { template<typename T> inline void somefunc(T a) {} };
what's wrong with that?
Extra semi colon.
Make a test case.
sbi
sbi
@wilx For me the most important thing missing in VS since VS6 is speed. You young folks might be unable to even imagine it, but it used to be that you would click on a menu item and the dialog box would pop up right away - on a machine bought 15 years ago! Nowadays, when I want to open, e.g., the project settings dialog, and I hadn't been doing that recently, it takes forever to load, freezing a 2.8GHz dual core machine with 8GB of RAM. This is most ridiculous and nearly insufferable.
08:57
I didn't noticed a large perf difference from VS6 to VS7, but I did notice a big difference from VS7 from VS8.
so why does this not compile?
Meh. templates confuse me
Missing #include <utility> and others?
And you have unbalanced braces near line 80.
@sbi: I do not find the experience as bad as you do but I agree that it is slower.
That's .NET for you :)
@TonyTheTiger The brace opened at line 56 is not closed.
OT: Do you not think that the whole idea of web applications has been taken too far? Why were Java applets not good enough?
It seems to me (I do not do either Java or we apps development) todays web apps development is way more complicated than doing similar simple Java applet would be.
09:10
Who is OT ?
sbi
sbi
@wilx Someone (@Jerry?) told me a while ago that, up to VS2010, there was no .NET in VS.
Yeah, VS10 was a big rewrite. The UI uses WPF now.
@sbi that's why I try not to click on menu items or open dialog boxes ;)
sbi
sbi
@jalf Well, it's hard to use a GUI application if you try to avoid using the GUI. And editing those XML files is quite error-prone, I found.
I wrote an addin (which works about 90% of the time) to add C++ projects to a solution, or .cpp files to a project without having to open the "new..." dialog
and using property sheets for nearly everything to avid having to open project properties
@sbi there was. But with VS2010, it became primarily a .NET app
at least according to VS devs blog posts, they've had bits and pieces written in .NET for a long time
09:22
@Tony may I ask what's different in the explicit specializations you have in that code?
Is this another one of those stupid exercises?
09:33
@jalf which, by the way, is just about the only nice thing I have to say about the MSVC build system. Property sheets are awesome
09:47
@RMartinhoFernandes the one sorts a struct by it's keys and the other just a basic data type such as int
yes, stupid excercise
@wilhelmtell I'd laugh at them.
10:12
Yeah, I wouldn't want to work there.
is there a way to overload operator>> on the ifstream so it read the data from the file straight into a struct ?
Yes.
Just implement something like istream& operator>>(istream& is, T& t).
hmmmm, that is a free function?
Yes, you can implement it as a free function.
where T is the struct ?
what if I want to get only part of a line of data read from the file, is there a way to get that from the stream?
Well, to be able to work on any stream, you have to implement it like template <typename CharT, typename Traits> basic_istream<CharT,Traits>& operator>>(basic_istream<CharT,Traits>& is, T& t);.
@TonyTheTiger Can you show an example?
data
key: 1252, value: 3256
I have a struct
struct data { int key; int value; };
so obviously I only want the ints on the data line, and not the strings
Do you need to validate that the strings are indeed "key:" and "value:"?
so I want to do instream >> line; and then the operator does the job
10:27
If not, you can just read them out to a local variable and discard it.
yes, well, I don't want key to end up in the value field of the struct
You mean you can have "value: 3256, key: 1252"?
oh, no, they will always be in the right order
never the other way
So, the data is always well formed then?
yep
though I only want this particular overload to be used for reading from the file, not when I use std::cin in other parts of my program
not sure if that makes a difference or not
10:30
In that case, overload it for ifstream instead of istream.
I think is >> dummy >> key >> dummy_for_the_comma >> other_dummy_string >> value; might work.
and what are these dummy's ?
like std::string or something?
Yes.
The operator>> for std::string reads until a whitespace, which helps in your case :)
hmmm
so a call to this operator>> from the filestream, will read to how far?
eof() or end of the line?
10:33
Whichever comes first.
so if it's a multiline file, the operator>> will be called for each read line?
If you implement it as I've shown, it will read groups of (a string, an int, a string, a string, an int).
Since you say the data is always wellformed, that would be the equivalent of a line.
hmmm I need to read a tutorial on this.... I'm still confused
But it would work if you put everything into a single big line with a space separating each group.
You can also use getline to read line-by-line into a string and then extract the values from those.
Xeo
Xeo
Ohayô o/
Xeo
Xeo
So, I heard the Tiger is missing me?
Hey, long time no see.
@Xeo Btw, I created Google Chrome extension using the MAL API
:D
Xeo
Xeo
Long time no see indeed
sbi
sbi
@Xeo Semester break, as I suspected?
Xeo
Xeo
Nope, that's yet to come
Just been busy with project and real life
sbi
sbi
10:52
@Xeo So where have you been buried?
@Xeo Oh. I see.
Xeo
Xeo
Hm. Since when do tags in the topic work?
Since a week or so.
Xeo
Xeo
I take links and other markdown still don't?
It's not part of the topic.
It's a separate field.
Xeo
Xeo
oh, I see now
10:58
@hexa lol the second most popular search term containing c++ is "c++ download" (nice link btw!)
11:33
oh hai
Hi
What's up ?
sick
:(
Still able to code ?
yeah
I've been eating too much "ok" stuff and made myself sick
I hate it when that happens
Hum, borderline food ?
11:40
some food makes me sick instantly
some food never makes me sick
and some food, apparently a lot more than I thought, makes me sick if consumed just a little bit too much
I see
that sucks
yes
it definitely does
because here you are chomping away happily on something that should be fine, and then you wake up the next morning and it's most definitely not fine
sounds like what alcohol does
Alcohol is not food. Despite some people treating it as such.
sure
11:44
@AlfPSteinbach: Thanks a lot, I got all the library functions to work! The library is very systematic, all the IntPtrs can just be treated as an opaque void*, and all the Strings are wchar_ts which I run through my standard mbstowcs mill. Cheers!
I don't drink
I suppose you have enough problems with "regular" food
fuck
I hate writing code in C++, I want to write in DeadMG++, this would be so much simpler
:(
When will DeadMG++ be released ?
11:47
iterators are such a hideous construction, I'm amazed anyone was temperate enough to write the Standard lib
whenever I get around to finishingit
Heh, iterators are awesome.
they take eternity to write if you want to be generic about it
@DeadMG: What made you so mad?
getting the right types to return, even in C++0x
and then basically having to write iterator and const_iterator separately
Something like C#'s yield would be nice to have.
11:49
nah
it's bad because C++ has shitty generic support
@DeadMG: Quite a lot of the stuff can be done by using Boost.Iterators' iterator_facade.
for example, can you perfect forward on this? No, you can't, you have to write every overload manually
Does anyone see the problem here ? ideone.com/uL7jV
can you type deduce on member variables for the return types of member functions? Har har, that would be too easy!
@kbok The vector is not initialized?
11:51
yeah, you never expanded it's size properly
@DeadMG: What?
I though it was automatic
only if you use push_back
when you use operator[] then that's C-array style access
i.e., make it as fast as possible and safety? Well, I hope you took care of it yourself
Ah ok.
11:55
hey
@DeadMG Scott Meyers says to implement the non-const accessor in terms of the constant one.
For complicated accessors this might reduce redundancy.
i.e., hack around it
Don't be cruel. It's a legitimate technology.
@jalf: Oh, by the way, now I'm getting PCH Intellisense errors in projects that never had them before. Your trojan solution is totally to blame
no, it's a hack around the fact that you can't be indiscriminate on *this
the same problem would arise if I wanted to perfect forward on it because I had functions that behaved differently if *this was an lvalue or rvalue
@DeadMG Well, you'd have to know your class to know whether it's safe, I suppose.
11:58
Wasn't there a proposal to add something to enable that?
But it shouldn't depend on other functions.
the cocking around necessary to get the correct return type for some of my generic functions is ridiculous
if only I could make a lambda as a member variable
Does anyone know .NET Reflector? I mean, how is it that a fully compiled .NET assembly contains the entire program source code? I'm baffled.
Is the same possible for Java bytecode?
0
Q: backup mysql database from Qt C++

Wallymysqldump -uroot -pmysql test> C/backup/test.sql If I run the command above in commandline, it will do a backup for my database "test" Now, I tried to use the same command inside my Qt C++ code, but it did not work, while I can insert,delete,and update my "test" database easily with no problems...

then look at the OP's comment
12:14
@hexa Wonderful.
@KerrekSB It doesn't contain the entire program source code. The difference between IL and source is the same as the difference between x86 assembly and source, the only difference being that IL is much closer to that source than x86 is
@DeadMG But the disassembly is entirely readable, including original variable names and all!
sbi
sbi
@DeadMG You'd die of thirst, if you wouldn't drink.
And control structures. And everything
I don't see how that's countering my original statement
sbi
sbi
12:16
40 mins ago, by DeadMG
sick
@sbi *alcohol
It just surprised me, and it makes me wonder how much actual "compilation" the .NET compiler does, as opposed to just some binary packing.
not much at all
that's what the JIT is for
however, x86 contains the control structures too
you just probably can't read them after all the inlining and such
if it didn't contain the control structures, how could the JIT execute them?
equivalently, x86 contains control structures, because how else could the CPU know to execute them?
@DeadMG Yeah, that's much harder to see through. Any sort of branching or looping may have got mangled or rearranged to death by the compiler.
so what?
it's still the same principle
IL is more human-readable, x86 is more machine-readable, but fundamentally, they must obey the same laws of intermediary representations of a program
12:18
I guess. Well, one more thing learned. Is it the same with Java?
yep
basically, anyway, I'm not that familiar with JVM bytecode
Any similar program to recover the source text?
but how else could they implement reflection?
Yeah, good point
I expect there is, but since I don't operate in the JVM world, I wouldn't know
12:19
So the two are really just glorified scripting languages?
and it doesn't recover the source text
it recovers the source code
hope you didn't want comments
and, well, yes, you could easily put it that way
@DeadMG No. C# programmers write self-explanatory code :-)
an interpreted language like Lua just does both steps in one go
12:20
Yeah, indeed.
you know
I started to ask a question about C++0x in Visual Studio 2010
I looked at the "Similar Questions" list
and about 70-80% of them I recognize as my own
12:46
Anyone knows what's happening here ? ideone.com/5NYwm
It compiles and run fine on VS2010 but gcc does not like that.
sbi
sbi
@kbok TTBOMK, even VC10 does not have proper two-phase lookup. Move the function above it's use.
That's a compiler bug in GCC for me
sbi
sbi
This compiles for me.
Great, thanks.
I would never have though this was this simple, lol
12:51
lol
If I have a constexpr function, assert shouldn't work in it, should it?
sbi
sbi
@Ricky65 Why do you think this is a bug?
ideone.com/caXMn that shouldn't compile because a run time function is called in an assert, right?
badly phrased
Also, is char(*)[!(has_const_iterator<T>::value)] = 0 really needed ? can we make it shorter ?
Use enable_if?
sbi
sbi
@kbok It's a common problem when you try to port template code from VC to other compilers. In VC, the compiler properly compiles templates way to late, and has thus more context than it should have.
12:56
Dunno if it'll be much shorter.
Am I right in saying that a C assert shouldn't be callable from a constexpr function?
@CatPlusPlus This is for educational purposes, so I try not to use boost. But I think it's worth using, even if not shorter, because it would be much clearer IMO.
enable_if is in the next Standard
sbi
sbi
Haha, that guy is totally missing my point. :)
Though only boost::enable_if_c (as std::enable_if).
13:04
what is the difference between enable_if and enable_if_c.
one takes an integral constant, another takes a type
_c takes bool, non _c takes type that's expected to have value constant in it. It's usually a bit shorter.
I am trying to overload operator>> for ifstream, however it says: "no operator >> matches these operands"
std::ifstream& operator>> (std::ifstream& ifs, srt::data<int> data)
{
	std::string keydummy;
	std::string valuedummy;

	int key;
	int value;

	ifs >> keydummy >> key >> valuedummy >> value;

	data.key = key;
	data.value = value;

	return ifs;
}
not sure what I've done wrong
Pass data via reference, for starters. Also show callsite.
haven't called it yet
sbi
sbi
13:18
@TonyTheTiger #include <string>?
Oh, and @Cat is right, you should pass data per (non-const) reference. Also, you should not assign to it unless the input operation succeeded. See here for the canonical form of an overloaded input operation.
@sbi and how does one verify operation has succeeded?
sbi
sbi
@TonyTheTiger if( ifs >> keydummy >> key >> valuedummy >> value ) ...
Also you don't need two variables for discard. One dummy will do.
sbi
sbi
13:33
Just ran into this: ʕ •ᴥ•ʔ
@TonyTheTiger include <string>
@CatPlusPlus Not UB?
Why would it be UB?
I don't know.
Sequence points modification shenanigans? (I have yet to read that FAQ question)
Can you guys open SO questions?
I'm getting cats.
You cannot evaluate it any other way than (((s >> a) >> b) >> c) >> ...
13:42
mw 2
Question lists seem fine, but the rest is broken.
Maybe not idiomatic, but I would prefer this signature: srt::data<int> readDataFromStream(std::ifstream&) {}
Breaks generality when you have to special case that type.
what's the most accurate way to time an operation in C++?
13:45
There's something in boost.
@DeadMG you probably just never noticed them before?
use a high res timer
With a profiler, after you've done developing.
there extrensive discussion here on SO
but i guess can't b reached ceurrently
sorry abt typos
@jalf nope
13:46
@CatPlusPlus Ok, I perhaps I would make data an output parameter. Then I can use overloading.
@StackedCrooked That's starting to look a lot like operator>>.
And then you can very well just overload >>.
sbi
sbi
@AlfPSteinbach Are you drunk or is your keyboard giving up on you?
@RMartinhoFernandes That's too much ASCII art for me :)
Breaking conventions is worse. :P
13:48
But I can always write a operator>> wrapper.
@sbi typing blindly
sbi
sbi
@AlfPSteinbach You are training to do that right now?
Your hands got invisible?
sbi
sbi
@Cat: Looking back at your last three statements I wonder which postings they refer to. It's really hard to tell.
13:51
@TonyTheTiger I think the std::clock() function is (en.cppreference.com/w/cpp/chrono/c/clock)
clock isn't very accurate.
It isn't?
I didn't know that.
You want to use QueryPerformanceCounter on Windows and gettimeofday on POSIX.
on most of the machines I've tried `clock()´ on, I seem to recall it used a 1-second resolution
which isn't exactly what I'd call impressive accuracy

« first day (304 days earlier)      last day (4870 days later) »