« first day (528 days earlier)      last day (4646 days later) » 

20:00
0
A: Correct way to protect against failed memory allocations using new operator and 2D Array

markWhich os are you compiling for? With some (e.g. linux) new will never fail, instead you will get a segment violation later when you use the memory! In this scenario you would trigger the segment violation during the first initialisation loop. It might be a good time to read some of Herb Sutters...

This guy is a nutbin right? Linux isn't that insane?
@MooingDuck 2D arrays? You know that pisses me off.
@RMartinhoFernandes "With some (e.g. linux) new will never fail, instead you will get a segment violation later when you use the memory!"
When GCC 4.7 was mentioned I forgot to point out that all the cool kids are using 4.8 anyway.
Right, that too.
(I don't have 4.7 release installed yet, only 4.6 and 4.8)
@LucDanton How so? Because all those bugs were miraculously wiped out of 4.8? :-)
20:02
I'm using gcc 4.5.1 (don't laught)
@KerrekSB 4.8 is a higher number than 4.7, duh.
I have a feeling that 4.6.x might become a vintage series.
@karlphillip 4.5.x is a pretty stable branch, no need to be ashamed.
Forget stable, I want moar features.
@Xeo That requires Clang, correct?
Xeo
Xeo
@LucDanton :>
20:05
I also notice that this builds it in C++11 mode, does that require a Standard lib?
doesn't it always?
Not when you're building a standard library.
Xeo
Xeo
Well, all I can say is that I could boostrap Clang+libc++ with GCC 4.4.5 and its stdlib
Ah, the crux of the problem is that Clang + libstdc++ doesn't work in C++11 mode after some point.
who will run for the next SO moderator ellections?
20:07
And I'm running $ man ln once more. Why is this so hard to memorise?
Xeo
Xeo
heh, the order?
Xeo
Xeo
$ ln target name
so, it's source -> dest
Yeah, now I know.
Tomorrow I won't.
Xeo
Xeo
And IIRC, mklink on Windows does it the other way around
And it requires special flags to say whether it's a directory or file symlink...
20:10
Someone have reasonable options to configure/build Clang with?
Xeo
Xeo
--enable-optimized=1 single-most important option if you want to use clang in the next 24h
--enable-optimized
Xeo
Xeo
--enable-targets=host-only is also nice
Meh, is there any library like Breakpad, except I don't know, user friendly?
What's breakpad?
20:15
Multi-platform crash handling.
@CatPlusPlus Make one.
Woot, it works! No more -lsupc++!
> I always get an Error... Note This is a Form so it is a Header File.
> undefined reference to symbol '__gxx_personality_v0@@CXXABI_1.3'
Fuck, it doesn't work. Back to -lsupc++.
What the heck is __gxx_personality?
It is posted:
0
Q: How to design a class with "annotated" fields?

Kerrek SBImagine we have some sort of protocol with hundreds of message types, each of which we want to model by a C++ class. Since each class should be able to process each field automatically, a natural solution is to just have an std::tuple with all the required types: std::tuple<int, double, char&...

MSVS association with .cpp and .hpp files is annoying.
I keep starting up the damn IDE accidentally.
20:22
@CatPlusPlus so associate them with notepad
or does it reassign them?
^ Really slow convergence with mr Newton & Raphson. Practical solution?
@KerrekSB unordered_map?
@MooingDuck Of boost::anys? Ewww.
@RMartinhoFernandes yeah, bad idea
@CheersandhthAlf Is there also a wcflush?
20:24
@MooingDuck Compile-time!
@StackedCrooked would have been funny if
Hey, all you trunk-build-compiler people: Does C++11 allow %lf in printf?
@KerrekSB macro magic. I have a macro that does something vaguely like that for enums
GCC 4.7 rejects it
@MooingDuck Post it
@CheersandhthAlf Esp with the std:: prefix :)
20:25
But heed the requirements
@MooingDuck I would also like the literal name.
@KerrekSB yeah, the macro did that. I just have to find it and see if I can alter it to do what you want
hmm, I'd forgotten just how scary this "macro" thing is
@KerrekSB Rightly so, there's no %lf thingy in C99.
printf is C domain, not C++.
Are you printing doubles or long doubles?
%f means double. %Lf means long double.
@MooingDuck I don't mind scary :-)
@RMartinhoFernandes I'm 99% positive there is
20:38
@KerrekSB I'm 100% positive there isn't! I win by 1%.
Mainly because I loudly asserted that there wasn't and remember the day ending in shame.
@KerrekSB that's too big for me to undertake at work, but I posted the code on your question as a possible option to look into.
Oh, wait, there is.
@MooingDuck I saw that; thanks!
anyone in here good with debuggin SQL?
20:39
@KerrekSB It's my turn to end in shame.
@RMartinhoFernandes ba-dum-dish
But %lf is the same as %f.
@RMartinhoFernandes Not just yet. The real question here is about C++11.
@RMartinhoFernandes That I know...
@KerrekSB C++11 uses the C99 standard library.
I guess my mind just wiped %lf as worthless.
@RMartinhoFernandes So what do your compilers say?
20:40
GCC rejects it, clang accepts it.
@RMartinhoFernandes GCC isn't worth the ASCII it is made of.
Why would you want %lf anyway?
@RMartinhoFernandes Second grade C programmers who write third-rate C++.
(Did you notice we're talking about printf here.)
Sure, but they can just use %f.
@RMartinhoFernandes I know, I know... converting the preacher...
20:42
There's zero need for %lf, other than crazy IOCCC reasons based on string length or something.
Where do I apply 'Look for the comment "FIXME: temporary hack: hard-coded paths"' given that there are, in fact, two such comments?
@RMartinhoFernandes But the codebase is already screwed.
@RMartinhoFernandes Building Clang from source is fun.
20:44
@LucDanton How are you compiling it?
@LucDanton Oh, you're fixing the header paths?
With GCC?
Yes and yes.
Yeah, I have a sed invocation for that in the PKGBUILD.
It looks for everything that looks like /usr/local/include and fixes it.
I don't know exactly where in the file that is.
@KerrekSB :%s/%lf/%f/g and hope for the best!
In clang/lib/Frontend/InitHeaderSearch.cpp?
20:46
Yes, that one.
Okay, that does tell me that that's at the first such comment. I.e. I fix the C++ include path in the AddDefaultCIncludePaths function, not the AddDefaultCPlusPlusIncludePaths.
Xeo
Xeo
@LucDanton Doesn't matter in which
I tested both
But I think the CPlusPlus one is safer
@Xeo There's an unreachable that worries me there.
@RMartinhoFernandes But would that ever get merged into the release? How do you explain to the maintainers that you need to touch 500 files?
@RMartinhoFernandes Why is there a %s?
@KerrekSB That's a vim command.
Means "substitute in the whole file".
20:49
@RMartinhoFernandes Oh great god
But now that you mention 500 files, sed is probably more appropriate.
@RMartinhoFernandes Can it substitute the whole editor? %e/%vim/%emacs?
@RMartinhoFernandes A checkin hook seems like the right thing! :-S
How do you explain to the maintainers: "do you want this to compile or not?"
"How many bug reports do you prefer to get about this?"
Oh, if anyone as suggestions for better tags or a better title for my question, I'd be grateful, too. I have a feeling that others must have faced the same question before, so it'd be nice if it were findable.
@CatPlusPlus Exactly.
Anyway, since we established that it is indeed perfectly fine C++11, there's no need to touch anything.
20:52
I want to confirm something: A virtual function over-ridden VS a non virtual function overriden -> The virtual is dynamic binding and allows polymorphic behavior (i.e I can use a pointer of type base class and still invoke the Deriving class's version of the function)
Btw, when I said "hope for the best" above, I meant "this might cause problems by replacing the wrong thing, so don't pin any responsibility on me".
@user1035219 "Overriding" implies virtual. Otherwise you're not overriding anything.
^ Switch back to the old image presentation in Firefox (if you don't like the black background and centering)
@RMartinhoFernandes I always carry a couple of one-way tickets and several credit cards, just for the case that "the best" doesn't occur despite my hopes.
20:54
@KerrekSB what if I derive from a class and provide own definition for a function which is NOT delcared virtual. won't that be over riding?
@user1035219 No. That just hides the base function.
You end up with a new, totally unrelated function, and the base function becomes invisible.
> I am an invisible function. — a book opening
@KerrekSB So the proper meaning of term 'over riding a function' means the base function is virtual?
@user1035219 That's the only meaning.
@KerrekSB Thanks!
20:57
@user1035219 No problem.
void invisible();
This is confusing. Do I need compiler-rt? For some reason I apparently did not check it out the last time I built Clang, even though it appears in the instructions. I'm getting errors about <new> not being found.
I checked it out.
Okay, the error is Clang not finding the includes.
Xeo
Xeo
@LucDanton You need it, IIRC
In any case, doesn't hurt to have it. That thing is so small
21:07
Haha, I got bitten by lousy Subversion. How surprising. Not.
@CatPlusPlus Going back from Git to Subversion is almost worse than going back from C++11 to C++98.
You need to train your mouse aiming skill.
Woah, what a failure.
Woop, there goes entire renderer.
Removing code is fun.
7
21:16
@CatPlusPlus but terrifying
Now, parsers and separating game data from core logic.
I'm afraid to use Spirit, it might make compilation even slower.
If that's possible
You need a mapping for that.
No, this time it was an entire directory.
21:17
Or perhaps an autocommand.
au BufRead ggdG
Needs pattern and normal, I think.
> ../src/stdexcept.cpp:18:10: fatal error: 'cxxabi.h' file not found
au BufRead * normal ggdG
@LucDanton Had that too. Solved it by lning into the include directory of libcxx.
Time to Bison.
I should be doing physics lab reports, but this is more fun, so.
You can't stop the fun.
4
21:21
@RMartinhoFernandes Thanks. Do I proceed similarly with the next error?
@LucDanton Yep. I had to it with cxxabi.h, the bits folder (I just linked the folder, didn't bother to check if it needed only one file from it), and cxxabi_forced.h IIRC.
Ah, it's a bit tricky in that there are two bits folder involved.
Mine was at /usr/include/c++/4.6.3/i686-pc-linux-gnu/bits.
Xeo
Xeo
@RMartinhoFernandes "cxxabi-forced.h" in GCC 4.4.5 :/
That is, hyphen instead of underscore
@LucDanton Oh, right, and /usr/include/c++/4.6.3/bits/cxxabi_forced.h
I had to do the uglies for that.
21:29
@RMartinhoFernandes Yeah, but where do I put the link to that?
I put in /usr/include/c++/4.6.3/i686-pc-linux-gnu/bits :S and then removed it.
Messy.
Xeo
Xeo
Yep, the cxxabi thingy is extremely messy for libc++ atm
Can't I do one or two find invocations to symlink all the stuff in either bits dir in a local bits dir?
You can use ln itself for that.
It can create more than one link with one invocation.
(I should've done that, but I only realised it later)
$ man ln again...
$ ln -s thingy1 thingy2 directory creates directory/thing1 and directory/thingy2.
Add shell globs and it's easy to make a directory of links to files in another.
21:36
How do I point clang++ to libc++ now?
Invoke with -stdlib=libc++. I haven't bothered to check how to make that the default yet.
My question is making that work without installing libc++.
Xeo
Xeo
> sudo cp /usr/include/c++/4.6/cxxabi.h /usr/local/include/
> sudo mkdir /usr/local/include/bits
> sudo cp /usr/include/c++/4.6/x86_64-linux-gnu/bits/c++config.h
> /usr/local/include/bits
> sudo cp /usr/include/c++/4.6/x86_64-linux-gnu/bits/os_defines.h
> /usr/local/include/bits
> sudo cp /usr/include/c++/4.6/x86_64-linux-gnu/bits/cpu_defines.h
> /usr/local/include/bits
> sudo cp /usr/include/c++/4.6/x86_64-linux-gnu/bits/cxxabi_tweaks.h
> /usr/local/include/bits
> sudo cp /usr/include/c++/4.6/bits/cxxabi_forced.h /usr/local/include/bits
From the clang mailing list
on building libc++ on linux
lolwut
21:39
So changing the _ to a - works?
Xeo
Xeo
@Insilico That was just for 4.4
How the hell does that work?
Mine works without messing in /usr/local/include.
It just needed those includes for the build.
Xeo
Xeo
So? Make it a script that creates the symlinks and removes them on demand
I do need to manually link to libsupc++ though. I'm too lazy to investigate further.
21:43
@RMartinhoFernandes Apparently both includes and libraries have to be part of the system's :|
Sorry, that doesn't parse. Seems to be missing one verb.
@LucDanton What's your reason to not install it?
I'm not sure how much I want to use all of that.
Following the installation steps doesn't seem to work in /usr/local/include, even though that path is searched for by Clang.
Yes, has to be /usr/include/c++/v1. I guess it's hardcoded. And that's another reason why I didn't want to install it: because that's a terrible process.
Damn, now I broke the Haskell LLVM bindings.
How come I completely fail at setting ldconfig to look inside /usr/local/lib?
(That's completely unrelated btw.)
Hmm, I thought building clang included building libLLVM. Seems I was wrong.
22:01
I don't get it :| ldconfig is set up to e.g. look inside /usr/lib/gcc-snapshot/lib and that works, but it won't for /usr/local/lib. The permissions, owner, and group of the libraries seem similar in both cases. Is there something about the ld.so.conf system I should be aware of?
@RMartinhoFernandes :%d
Oh okay I got it D: Confusing stuff.
args dir/*
:silent argdo %d
ggdG looks cooler.
@CatPlusPlus yathink?
22:05
Aye.
What's ggdG? This?
I usually think ex commands look clearer. Besides they are much easier composed in other ex commands such as windo/argdo/bufdo/tabdo and global
Go to the beginning of the file, delete till end of the file.
@Pubby Vim
Ah
22:06
@Pubby That supposed to be a Nokia viral ad?
I'm going with Spirit after all.
@sehe Yeah, from like 10 years ago
@CatPlusPlus Yay. Where?
This bloody game. I need a sane parser for the data files.
You consider Spirit to be a sane parser? :-)
That thing is fucking borderline magic
^ This is the current one.
Yeah, a sane parser is called for.
It also breaks on x64 thanks to C and type punning.
@Insilico No, but you can write a sane parser with it
22:09
Pointer casting everywhere.
Also the typical C 'generic' list powered by void*.
Who the fuck wrote that?
Also no error recovery or hope of squeezing error recovery there.
Why did you let C people into the project?
Ah, the C people produced a library called libtcod.
@CatPlusPlus hope of recovering of sneezing error?
22:10
It was on the project before I joined.
lol
@CatPlusPlus Oh.
Squeezing error. Like when you squeeze something you weren't supposed to.
So, does that mean I should avoid libtcod? (I was thinking of using it for my roguelike)
Damn frakking t is broken again.
Well. Let me tell you this way:
Yes.
Well writing those algorithms in Haskell will be fun.
22:12
Console thingy is powered by mixture of SDL and OpenGL 0.9.
Tree, list and all that is Cishness all the way down.
Colour is not even all that useful, and it's really two functions and lots of constants.
Pathfinding works, but the API is C-ish, too.
LOS supposedly works, too. Dunno if we use that.
Parser is FUBAR.
Wait, tree, list? I thought it was a lib of algorithms for pathfinding and LOS and shit.
I don't need containers.
Yeah, but it also has the typical "it's C, so we reinvented ton of containers".
And they use it in other components.
Ah, there's also crappy RNG.
So, nothing actually usable?
And name generator that depends on both parser and RNG, so while it works, it's meh.
Heightmap works too.
But you can use libnoise for heightmap and other noise.
Haven't used BSP.
And there's some line stuff, which I think is used by FOV, so it probably works.
I already implemented FOV anyway.
22:16
I'm just ripping it out, and then try to salvage whatever is needed.
No point in using C API if you can rip the internals out and use them with a nice API instead, hrhr.
Wait, did you say OpenGL 0.9 above?
Anyone has a recommendation for good interaction between shell aliases and Vim?
Yes.
To emphasise how much it sucks.
It supposedly has shaders, but the overall quality is somewhere near the floor.
Oh wait, I think it's actually an issue of path.
conwidth * conheight * ~11 draw calls .
In every frame.
And that's just inner loop.
I truly have no idea what the hell OpenGL is there for, anyway.
22:25
@CatPlusPlus Wait, wut?
Look at that file.
LOOK AT IT.
Oh, that's the one that uses ARB_shader_objects.
No, it's not that one. But now I know where the other one got that crap from.
sigh
22:27
lol
What do you recommend for the consoling? I can't get any ncurses binding to work in Windows. Shall I give SDL a try?
Is it just me, or does libtcod have libSDL.so in the repo?
It has several precompiled binaries there.
PDCurses works on Windows. And can render to SDL window.
(Disclaimer: SDL sucks, don't use it.)
@CatPlusPlus Arrgh, I'll have to write my own bindings!
Mmmh, Clang doesn't do SFINAE on aliases right now?
Wut, also Clang requires that a member be declared virtual to also be marked override.
SDL is a dead project afaik.
glut is usually what I use for play.
I guess that's that then. Oh well, Clang did catch two errors in my code.
22:40
@LucDanton Oh, that's bad.
Is that for real <gasp>
I'm not clicking on a Daily Mail link.
Got to admit: it's bound to work
Now you're between a rock and a hard place. Mwhahahaha.
It's not really relevant, is it?
user457812
22:45
@TomKerr glut is pretty dang dead
is it?
user457812
You might wanna look into GLFW or SFML
this is awkward.
user457812
SDL is alive, but it's currently being remade for SDL 2.0
alright, I am looking.
22:47
@LucDanton That never stopped me before.
@sehe No idea.
user457812
freeglut (and maybe the Mac OS glut implementation) might be the exception, but glut itself died a long time ago.
It does sound like something out of the Onion.
@RMartinhoFernandes Is there a variable like _ in Prolog?
oh, yea, freeglut is what I use.
@Pubby Is there a reason you're asking me this?
user457812
22:49
@TomKerr Probably safe then.
I think _ means the same as in Haskell.
@RMartinhoFernandes A lot of the stuff in the Onion sound like something out of the Daily Mail.
Raise your hand if CapitalizingFunctions() would deter you from my project.
@RMartinhoFernandes I'm trying to do some Prolog stuff but I can't get it to work
22:50
It's a been a while since I messed with that.
But if I can, I'll help. I'm not squicky around Prolog.
user457812
@Maxpm You mean capitalizing function names or just whether that particularly unusual function name would deter someone?
@Maxpm Hi.
user457812
'Cause if I saw that function name I'd call in a napalm strike
PascalCase in C++? EWww.
I think it would be especially interesting as it takes in no arguments.
22:51
@nil Capitalizing the first letter of function names.
@RMartinhoFernandes I'm trying to do the last exercise on this page: learnprolognow.org/… and this is my shitty code: pastebin.com/Fgp5pm0X
What the heck is Prolog?
A programming language.
Ow, the website. My eyes.
Prolog is a general purpose logic programming language associated with artificial intelligence and computational linguistics. Prolog has its roots in first-order logic, a formal logic, and unlike many other programming languages, Prolog is declarative: the program logic is expressed in terms of relations, represented as facts and rules. A computation is initiated by running a query over these relations. The language was first conceived by a group around Alain Colmerauer in Marseille, France, in the early 1970s and the first Prolog system was developed in 1972 by Colmerauer with Philip...
22:52
Capitalizing the first letter of free functions and statics is what Java does. I don't think it is that weird.
This is how I run it:
?- crossword(V1, V2, V3, H1, H2, H3).
V1 = V2, V2 = V3, V3 = H1, H1 = H2, H2 = H3.
user457812
Wouldn't really bother me as long as it's consistent throughout a project.
yep, same.
Why do you have things like word(V1, _, A, _, _, _, _, _) = word(H1, _, A, _, _, _, _, _)?
@RMartinhoFernandes I dunno, I thought that was how it could be solved
22:54
@TomKerr Java has no free functions. I have never seen a capitalized method in Java; only capitalized classes.
AFAIR You can't compare things for equality like that.
@nil @TomKerr Okay. Thanks.
ah, right. just static functions then. brain fart.
It's supposed to be doing unification, not equality
What's the = for?
22:55
That's unification (operator?)
No, unification is implicit.
word(V1, _, A, _, _, _, _, _), word(H1, _, A, _, _, _, _, _) means "the third parameter of each predicate is the same"
(Note the comma, not =)
Oh, right
V1 = astante,
V2 = baratto,
V3 = statale,
H1 = astante,
H2 = baratto,
H3 = statale
Yay! Thanks for the help.
That's not the solution.
22:58
What do you mean? Because of dupes?
Is there a trait that retrieves the type of a tuple element?
Right.
@KerrekSB tuple_element
@Pubby I got the impression it were to use all six.
How do I remove dupes? :S
like tuple_element<T, 5>::type?
22:59
Grandiose

« first day (528 days earlier)      last day (4646 days later) »