« first day (456 days earlier)      last day (4718 days later) » 

00:00
one short question, int A[2][2]={1, 2, 3};
by the standard elemet A[1][1] is 0, or it is by some compilers?
your initializer is too large
int A[2][2]={{1}, {2}};
cout << A[1][1] << endl;
yes, by Standard all such elements are 0
@DeadMG No, why? You're allowed to collapse braces for md arrays, non?
@KerrekSB Not as far as I know
00:08
@KerrekSB Yes, you are allowed to.
@DeadMG Hm... I'm pretty sure I've read that somewhere. Just got to make sure it wasn't on cplusplus.com
3
A: std::array<T> initialization

Johannes Schaub - litbThe benefit is that you have ... less to type. But the drawback is that you are only allowed to leave off braces when the declaration has that form. If you leave off the =, or if the array is a member and you initialize it with member{{1, 2, 3, 4, 5}}, you cannot only pass one pair of braces. Th...

@KerrekSB It has always been allowed in C++.
@FredOverflow Cool thanks.
 
1 hour later…
01:13
damn
why is it so hard to visualize code?
01:26
hey
anybody about?
I'm here
hey I have a question
It is silly but i just cant figure it
So i have written a short bit of code that shows all file in a dir
but i cant figure out how to get the path of each file so that i can get more info from stat()
return 1;
oops
I know it is something really small and stupid, i just cant put my finger on it
i know that to stat it i will need to get the path and the name and pass them both into a char
01:41
make a post?
no, I'm linking you to it, twice, so that you can totally ignore it
see, this is the chat for the C++ programmers to chat in, not the C programmers to ask random Unix questions in
sorry man, tired... I figured it was so small there was no point making a post
C++ C same shit different day
you obviously don't know how to code C++
Well maybe I do, maybe I don't... Either way, people asking for a little help is no reason to act like a tool
this is not the "help me" section
that's the "Ask a question" button
01:43
@Charlie: I think the fact that not all C code is valid C++ code makes it by definition different languages.
Well I hope you remember the day when you were new and you needed help and some nice people helped you
@Charlie: If you think it's something really small and stupid, consider using the Rubber Duck Programming technique. en.wikipedia.org/wiki/Rubber_duck_debugging
I do
I pushed the "Ask a question" button
and received help
and I help many people who push that button
there is a question button
I never would have guessed
02:21
In case someone wants to marvel at my system specs and my tenacity at refuting false benchmarks see:
(PS. my responses are the ones by 'sgheeren'; for a little background: the guy was comparing speeds of compiling a 'larger' project between Zfs-on-linux and zfs-fuse. The OP is a major contributor to zfs-fuse, so his bias is understandable)
@DeadMG <plink>sry to wake you; just saying I'm going to bed<plink/> :)
03:02
lol
user406009
03:32
That rubber duck link was funny. I actually think alot of the help in IRC chat is like rubber duck debugging.
user406009
Everyone here is a duck.
I'm not a duck.
Indeed, you're a cat.
Hello by the way.
04:28
echo ‘echo sleep 1 >> ~/.profile’ >> /home/unhappy-user/.profile
Every time the user logs in, it takes a little bit longer.
That is downright evil.
Xeo
Xeo
04:58
Wow, now I know what C pointer and syntax hell looks like.
int main(){
    static unsigned const rows = 3, cols = 3;
    int x[rows][cols] = {0};

    for(int i=0, (*p1)[cols] = x, (*e1)[cols] = p1+rows; p1 < e1; ++i, ++p1){
        for(int j=i, *p2 = *p1, *e2 = p2+cols; p2 < e2; ++j, ++p2){
            *p2 = j;
        }
    }
}
05:14
@Xeo lol... That actually is pretty bad. Who's idea was it to put 3 initializers in both nested loops?
Xeo
Xeo
@Mysticial Mine, while putting together an SSCCE for a question xD
@Xeo lol
Xeo
Xeo
It's as concise as it's going to get, even typedefs won't help!
I would pull 2 of the initializers out of each loop, and leave only the simple one. Makes it easier to read. For me at least...
My personal hell is filled with raw pointers, and every time I want to use a smart pointer, my heap gets corrupted.
Xeo
Xeo
05:27
lol?
@EtiennedeMartel While I was interning at MS, they tried to make me use smart pointers. All I got were heap corruptions. It seems that smart pointers were only designed to be used by smart people.
@Mysticial C++ was designed to be used by smart (read: suicidal) people.
Xeo
Xeo
06:03
Wtf. Why is std::iota defined in <numeric> and not <algorithm>? -.-
Wait, std::accumulate is also defined there..
@EthanSteinberg you called?
06:40
Hello all :)
@MooingDuck Hey ! How've you been :)
Does anyone know of a way (In windows) to execute a system() command from a program and not wait for it to return ?
Xeo
Xeo
@angryInsomniac Put it in a fire-and-forget thread?
@Xeo At the risk of sounding like a dumbass , I dont know what that means :) can you point me to any literature ?
Xeo
Xeo
Do you know the term "fire-and-forget"?
@Xeo In my research about the topic I found that there is something called "start" which might be able to do this
@Xeo I cna imagine what that would mean from context
@Xeo Make a new thread , execute the process and forget it in the parent program (just take it to completion)
Xeo
Xeo
a fire-and-forget thread is basically a thread you start but don't care about its further existence, you start it up (fire), and forget about it. :)
Of course, error handling for such threads is, erm, difficult
06:57
@Xeo This may sound a bit churlish , but I have some deadlines and don't really want to get into multithreading for something so simple ! Would you happen to know anything about this so called "start" command ?
Xeo
Xeo
Oh, you meant the Windows command?
@Xeo I didn't :) but just realized what it was when you said "windows command"
Xeo
Xeo
Since start immediatly returns, system should too
07:13
@Xeo Yup , it works now ! Thanks
Xeo
Xeo
Great, my Visual Studio 11 installation is somehow fucked up and I can't even Repair it with the installer. -.-
@Xeo As with almost all windows problems ... just remove the damn thing and reinstall it :D
Holy shit ! a sleep of 1 millisecond means the difference between 25 cpu and 2 cpu !!
08:02
hi, anyone knows how to include "absolute paths" in a Makefile (Windows) ?
08:57
Unable to resolve identifier NULL < --- must be an IDE error right ?
 
1 hour later…
09:59
0
Q: How can I initialise a member std::array of objects that don't have a default constuctor?

Tim Yorke Possible Duplicate: Using std::array with initialization lists Here's the code that I have a problem with: class Foo { public: Foo() : memberArray{Bar(1), Bar(3), Bar(2)} {} struct Bar { Bar(int param1) { } }; private: std::array<Bar,3> membe...

should be reopened
Xeo
Xeo
10:18
@Sidar You need to include <cstddef> for the NULL macro to be defined
10:58
Just spent like 3 hours figuring out why TFS Dev preview isn't installing
Check the SHA-1 and it's corrupt -.-
sbi
sbi
@JohannesSchaublitb Open.
Ell
Ell
11:14
hey
:)
Hey :)
Need a standard quote for "references can't be null". Anyone knows in what section may I find that?
@RMartinhoFernandes sure, just a minute...
@RMartinhoFernandes 8.3.2/5 in the note
11:18
Note: in particular, a null reference cannot exist in a well-defined program, because the only way to create such a reference would be to bind it to the “object” obtained by dereferencing a null pointer, which causes undefined behavior. As described in 9.6, a reference cannot be bound directly to a bit-field.
ah too late :)
any xvalue when evaluated must refer to an object or function
so when that is not satisfied, you have UB
Also, right before that, what @JohannesSchaublitb said, but for references: A reference shall be initialized to refer to a valid object or function
that's a diagnosable rule
it is not UB
Yes! I finally managed to get a good version of the TFS disk :D
11:21
@JohannesSchaublitb you can't diagnose if a null pointer is dereferenced to initialise a reference, can you?
if you violate " A reference shall be initialized to refer to a valid object or function", the compiler must emit a diagnostic
@rubenvb yes you cannot. which means it is likely that statement does not intend to forbid null pointers
Can someone help me make some sense of my memory Leak dump ? (this is the first time I am doing memory leak analysis) pastebin.com/0PP3Hd5D
it covers such things as " As described in 9.6, a reference cannot be bound directly to a bit-field."
@JohannesSchaublitb The compiler cannot always know that.
void f(int* p) { int& ref = *p; }
@RMartinhoFernandes there is no bitfield in sight in that example
user784668
11:24
@JohannesSchaublitb The halting problem is proven undecidable.
I didn't refer to bitfields.
@RMartinhoFernandes then i don't understand what your statement refers to
All you have to do is follow the arrows.
@RMartinhoFernandes if "p" is a null pointer, then behavior is undefined, and no diagnostic is required for all other diagnosable rules anyway
@JohannesSchaublitb either he first part of the note I quoted, or the next thing I quoted, being the sentence before the note
11:25
still "A reference shall be initialized to refer to a valid object or function" requires a diagnostic. of course only if no undefined behavior occurs
@JohannesSchaublitb Oh, I see. That makes sense.
Hey Martinho , how've ya been ? :)
Can you help me make some sense of my memory Leak dump ?
jjj
jjj
hey guys
@angryInsomniac Hi there. You mean a valgrind output or something?
@RMartinhoFernandes Umm I am using the Visual studio memory leak detection tool, it indicated some leaks to me but I'm not exactly sure what the utility is telling me !
user784668
11:34
1
Q: What's the difference between input iterators and read-only forward iterators?

FanaelThe title says it all: what's the difference between input iterators and read-only forward iterators? Because the latter are read-only, they obviously don't satisfy requirements of output iterators. And, because of that, they're effectively input iterators with additional guarantees (if any). Th...

Oh, I don't have experience with that thing. I didn't even know VS had that.
user784668
Are there other differences besides what Xeo said?
@RMartinhoFernandes I know the exact cause of the leak would depend heavily on my code , but if i just understood what the utility is telling me I could probably be able to solve the problem !
@RMartinhoFernandes ohh Well .. If you run into some kind soul who does , tell me :)
@x
@xeo Thanks
Xeo
Xeo
11:47
For those who understand German in here: A funny (fake) Taliban confession video made by my math docent and a bunch of other people. :)
They're basically confessing to be behind the "tomato-and-cucumber attack" on the burger king in Gießen. :)
Wow.
Xeo
Xeo
The rep I gained from that answer
So 45 out of 60 votes contributed to my reputation
So, people that use expensive compile time template methods get more upvotes than people who can apply little math for such a simple problem?
@rubenvb that's gross
math should be superior
11:56
well, the second and third answers got the math right at least
Even though it's off-topic, I like the Template Haskell solution in there: it actually compiles!
you can print the number using ASCII art
the pointer declarator "*" can serve as the pen
Xeo
Xeo
I don't think you can actually print numbers with that. How would you do the indent?
Use many structs named _, __, ___ and so on?
I doubt that would work on GCC.
Xeo
Xeo
in before "challenge accepted" by @Johannes
12:00
@RMartinhoFernandes i did it before with a simple triangle
Then what are you waiting for?
the instantiation stack served as the linefeed
i imagine it is difficult to do xD
Xeo
Xeo
@JohannesSchaublitb Still, how would you do the spacing?
Or would the * serve as the spacing and a _ struct as the actual "ink"?
17
A: Simple fun C++ Asterisk Hill

Johannes Schaub - litbSome fun with GCC's error messages... // going up to the tip... #line 1 template<typename T, int N, int M = N, bool up = true> struct hill { typedef typename hill<T**, N, M - 2>::next next; }; #line 1 // ... on the tip! down now again ... template<typename T, int N> struct ...

lol
Xeo
Xeo
You already have my upvote for that. :P
Do code blocks in extern "C" get compiled by the C compiler or C++ compiler in some stripped down C mode?
C++ compiler, with the C ABI.
ah, ok
makes sense
could've thought of that myself :/
Thanks
@Xeo Tsukihime is way too addictive. Installed it yesterday and ended up playing 12+ hours continuously.
Xeo
Xeo
@StackedCrooked Ha! :D
@StackedCrooked "TYPE-MOON is way too addictive." FTFY
@StackedCrooked Do you play with or without the flowchart?
12:16
Now I'm stuck, I keep dying somewhere.
@Xeo Without. The readme file said I should avoid the walkthrough.
Xeo
Xeo
I hope you have enough backtracing savepoints. :)
With TYPE-MOON games, you can play yourself into a dead end for over half an hour and even longer
@StackedCrooked A flowchart is not directly a walkthrough. It's just a chart that shows which influences your descisions have
When using pointers in methods that point to objects which have pointers outside the scope of the method. Can I just leave them be, or do I need to set those pointers to null before exiting the method scope?
@Xeo Ok, that might be interesting.
Xeo
Xeo
setting local pointers to null is useless
and with local I mean local variables or parameters
It's removed from the stack right?
Xeo
Xeo
12:19
Unless they're actually references to pointers
after it goes out of scope
Xeo
Xeo
yeah
Well I use the objects outside the method that have a pointer to the same object
Xeo
Xeo
@StackedCrooked You should have a flowchart.pdf in your Tsukihime folder
I was about to call the delete on them but realised the object in memory will be gone forever
Xeo
Xeo
12:21
Correct
thanks
I'll check it out. However, I need to sleep first because I notice that now I just keep pressing enter without reading the text anymore. (Usually a sign that a break is needed :D )
Xeo
Xeo
But since you mentioned delete, I have to mention smart pointers
3
Can someone help me make some sense of my memory Leak dump ? (this is the first time I am doing memory leak analysis) pastebin.com/0PP3Hd5D
user784668
Yeah, I just wrote my favorite constructor type! explicit SomeClass(DoNotInitialize)
12:23
@angryInsomniac What tool are you using? Try valgrind.
@angryInsomniac Hmmm, that looks not very helpful.
smart pointe?
valgrind tells you who allocated the lost blocks.
There's nothing there to interpret but bits from your program. You want stack traces of who allocated the memory.
@Potatoswatter Ok , I'll check that out
12:24
But valgrind is Linux-only :(
user784668
@RMartinhoFernandes er, wrong?
@RMartinhoFernandes Works for me on Mac… Don't know about Windows.
user784668
@Potatoswatter They're too lazy to port it to Windows.
So it's basically a garbage collection mechanism
12:24
I'm using Windows :(
Xeo
Xeo
Okay, valgrind is non-Windows.
Anyway, it appears he is porting it to Windows 7, so perhaps the other platform is non-Windows.
user784668
@Potatoswatter And they prefer to lie that it's not feasible, instead.
Xeo
Xeo
Like every second awesome tool
@Fanael Oh, when did that change?
12:25
@angryInsomniac then recompile and check under linux
@Potatoswatter nope ... its from win Xp
Well, if nobody does it, then by one important metric it's not feasible "enough"
if it's not in platform specific code
Ah, ok, still no Windows.
user784668
@RMartinhoFernandes Dunno. But it works on Mac.
12:25
@rubenvb It is ... its a game that uses DirectX
Being open source, if someone really likes Windows that much they can bring Valgrind to it.
user784668
@Potatoswatter I have seen an incomplete Windows port of valgrind once.
ah, misread, ignore me
Any other tips ?
Xeo
Xeo
@angryInsomniac Use smart pointers.
12:27
@Xeo You do love your smart pointers don't you ? :D but at this point re-engineering the whole thing to use smart pointers is not an option
user784668
@Potatoswatter And it didn't look like "it would require so many changes it would almost be a separate project".
Yeah, what @Xeo said. I realize it's not super helpful when you've got some existing code with bugs in it. But I find it easier to avoid memory leaks than to fix them. Smart pointers (and other RAII tricks) prevents memory leaks from occurring in the first place
Xeo
Xeo
@angryInsomniac Every good C++ developer should love them.
Hopefully, this episode will serve as a lesson ;)
Xeo
Xeo
They're essential for idiomatic, modern C++ code. (Well, actually, RAII is. Also called scope-bound resource management.)
12:28
@Fanael I have no idea. There's the XP kernel, the 7 kernel, and soon 8. IMO Microsoft should take responsibility for it.
@Xeo Hmm , true , this code was just made at a time when I had no concept of memory leakage :P
A tool like that has a lot of devils in the details.
@angryInsomniac try VS's memtrack (seems to show stacktraces): msdn.microsoft.com/en-us/library/ms859419.aspx
0
Q: C++ string::substr complexity

FarzamWhy the c++'s implemented string::substr() doesn't use the KMP algorithm (and doesn't run in O(N + M)) and runs in O(N * M)? Is that corrected in c++0x? If the complexity of current substr is not O(N * M), what is that?

Xeo
Xeo
@angryInsomniac Well, how long is your application expected to run?
12:29
What's the KMP algorithm?
user784668
@Potatoswatter NT != Linux, it has very stable API and ABI. They just add things, very rarely change or remove existing ones. So there's basically one kernel to take care of.
Xeo
Xeo
@RMartinhoFernandes Make a comment?
@Xeo Well , its a simple game with the player continuing till he dies ! So might run for a long time
@Xeo I'm googling first :)
@Xeo What I dont understand is ... I've made sure that all destructors take care of all the pointers assigned in any class ... but there are still leaks !!
12:31
Handwritten, non-copy-and-swap assignment operators?
… or any kind of method that replaces a pointer.
@Xeo I can only find a walkthrough in the game dir. I found this flowchart online though. Pretty massive!
Xeo
Xeo
Wtf, 4 pings?!
A number of those blocks are 1 byte long, which is a serious code smell. They might be empty strings.
Xeo
Xeo
@StackedCrooked Which patch did you install?
12:33
@RMartinhoFernandes Shouldn't that be about find rather than substr? Or are there 'clever' overloads of substr?
user784668
@Potatoswatter Please don't tell me you never used new char! True Programmers use freestore for everything!
@Xeo Two patches. I think it was 1.1 and 1.2, or 1.2 and 1.3. Don't remember exactly which. Anyway it's working really well.
@Fanael Because it's free!
@LucDanton Dunno. I never heard of KMP before. Also, no time to investigate now. Lunch.
Give-away shops, swap shops, freeshops, or free stores are stores where all goods are free. They are similar to charity shops, with mostly second-hand items — only everything is available at no cost. Whether it is a book, a piece of furniture, a garment or a household item, it is all freely given away, although some operate a one-in, one-out–type policy (swap shops). Concept The free store is a form of constructive direct action that provides a shopping alternative to the capitalist framework, allowing people to exchange goods and services outside of a money-based economy. The roots o...
@angryInsomniac then either (1) one of the destructors is buggy, or (2) some of the pointers are never stored as class members
Xeo
Xeo
12:36
@StackedCrooked No, I meant which translation patch?
@Xeo Yes, I am referring to those.
@jalf ! So you mean that if I declare pointers in a class constructors parameters , they too get added to the memory ? and are never cleared ?
Xeo
Xeo
@StackedCrooked Okay, simpler: From which group?
Mirror moon. 1.1 and 1.2.
Btw ... I did find a good memory leak detection tool : vld.codeplex.com
Xeo
Xeo
12:38
Hm, maybe you unchecked "Flowchart" in the installer?
If you want, I can send you mine
Ah, the flowchart is probably now automatically copied to the game dir.
@Xeo Downloaded the patches again and now I find the flowchart in there.
Xeo
Xeo
/shrug
Anyways, back to Carnival Phantasm, Episode 10!
It's, like, super-special-awesome!
I don't see much relation between the game and Fate Stay Night and Kara no Kyoukai yet. Except for "magus".
2
Q: Does C have a standard ABI?

FredOverflowFrom a discussion somewhere else: C++ has no standard ABI But neither does C, right? On any given platform it pretty much does. It wouldn't be useful as the lingua franca for inter-language communication if it lacked one. What's your take on this?

But I haven't completed any routes yet. So...
12:43
@FredOverflow What do you mean by "standard ABI"? An ABI is by definition a function of a specific platform.
29 mins ago, by R. Martinho Fernandes
C++ compiler, with the C ABI.
@Potatoswatter I just wanted to mention that there is no such thing as "the C ABI".
Xeo
Xeo
@StackedCrooked It's just the complete universe (also called Nasu-verse after the creator). They don't specifically have anything to do with each other, but they are all set in the same time-space. Like the mystic eyes of death-perception that Shiki (KnK) and Shiki (Tsukihime) have.
user784668
@FredOverflow There is the C ABI that the C++ compiler in question strives to conform to. I guess that's what he meant.
@FredOverflow Oh, didn't see the reply. But in this case the C++ standard specifies that the C ABI should be used, whatever it is.
The requirement is fairly nebulous, but language linkage is supposed to support C, Fortran, etc.
@Potatoswatter Really? Where exactly does it state that?
12:48
§7.5 [dcl.link], which begins:
> All function types, function names, and variable names have a language linkage. [Note: Some of the properties associated with an entity with language linkage are specific to each implementation and are not described here. For example, a particular language linkage may be associated with a particular form of rep- resenting names of objects and functions with external linkage, or with a particular calling convention, etc. ]
ABI != language linkage IMHO
Language linkage is the C++ abstraction of different ABIs. Nothing more and nothing less.
Xeo
Xeo
I think when people say ABI, they generally mean the name mangling.
Name mangling is exactly what language linkage controls.
extern "C" = disable name mangling, just use the identifier in the object file. extern "Fortran" = same but disable case sensitivity too (IIRC).
@Xeo indeed, that's part of ABI, but it really is a lot more (calling convention, etc...)
user784668
12:51
@Potatoswatter extern "Fortran"? That's some strange extension.
Yeah… on some platforms Fortran and C have different calling conventions too.
language linkage ~ name mangling could be more appropriate.
@Fanael Well, it's the next most common after "C", but only a distant second.
Ok I really need some help , does anyone have some free time ?
@FredOverflow Well, whatever is needed to make it edible by an appropriate C compiler.
Xeo
Xeo
12:55
Btw, @StackedCrooked, Tsukihime robbed me off my entire october holidays (2 weeks) once. :) I nearly finished every route there was, except one (where I'm still at maybe one-third, because I don't like the heroine).
@Xeo Today I ended up mostly with Ciel while I intended to start with Arcueid. I think I'll start from scratch tomorrow.
Xeo
Xeo
Ugh, Ciel. That's the route I meant. :)
Btw, Shiki's first encount with Arcuid is hilarious
It was pretty dark imo...
Xeo
Xeo
17 pieces :D
Neatly sliced :D
Xeo
Xeo
12:59
Well, Tsukihime is pretty gruesome

« first day (456 days earlier)      last day (4718 days later) »