« first day (509 days earlier)      last day (4661 days later) » 

17:16
Hi
How do you guys usually implement the visitor pattern? I find using inhertience and virtual methods tedious..
hi , i'm trying to install visual c++ , i get this error : Error 1304. Error writing to file: Microsoft.VisualStudio.ExstensionManager.dll. Verify that you have ac/cess to that directory
what is the problem?
running as admin?
yea
something open that may currently using that file?
no, are running just firefox and skype.
17:24
@RMartinhoFernandes An overloaded semicolon, lols
@ddacot Out of disk space?
@Nils If the entire set of types is known at compile-time you can use templates.
no, there are about ~74 GB free on c:\ drive
@Nils I implement design patterns?
@RMartinhoFernandes I haven't thought about this yet, just used function pointers. However my Qt book also suggests the use of signals and slots.
@DeadMG Well I'm travelling a DOM tree and have to do something for every tag with a certain tagname.
17:28
uh
something wrong with recursion?
no of course not
then why waste your life on visitor pattern?
@RMartinhoFernandes what can be the problem?
@ddacot I think I exhausted all the possibilities. I'd check if it's a known issue (see if googling the error message gives something). Otherwise, I'm out of ideas.
@DeadMG Well I have to do multiple things with it and want to avoid code duplication obviously..
17:32
how does recursion involve code duplication?
if you have to do it again for a certain function
Well so far i had travelDOM(funcPtrToExectueOnTag) then I tried to use the visitor pattern using inheritance and virtual methods and realized that I would need to create a new class for everything I want to do with all these tags.
hm i don't like fanboys
takes 2 much energy
also, function pointers are really bad
what's needed for raw efficiency is raw arrays, raw data pointers, raw function pointers, and unsigned arithmetic
andrew wrote about the latter in ddj right now
@DeadMG yes, so I hope you have a better idea :)
17:43
also, of course, use bitlevel boolean operators, not those inefficient fancy double symbols that to boot are twice as much to write
std::function?
@CheersandhthAlf And MACROS!
I don't have c++11 at work.
boost::function
meh
17:44
"I don't have boost at work"
and macros for inlining and sheer efficiency, yes! :-)
Did I guess right?
Using a new lib just because of this seems a bit too much.
also, use duff's device wherever applicable.
use the lib you need
17:45
Also I never read good things about boost catnapgames.com/blog/2012/03/02/boost-bloat.html
Boost contains plenty of other goodies
humm
oh waaah waaah, some dude replaced it with his own hand-rolled perfect version and cut down on his executable size
Fact: Boost provides what you need
so either roll your own function<Ret(T...)> class, or use Boost's
ok
TR1 has one, as well, I think
17:47
So can I get this to work with VS2008?
Well anyways I have to go, thx for the suggestions
they should have a TR1 header that provides function for you
I think
yeahhh, they do
There's that word again.
huh?
17:51
It works!
lol
heyheyhey
my application not only compiles and links, but also executes!
issamiracle!
But mine does all that and works.
of course, it would be more of a miracle if it rendered correctly, but issastart!
oh yeah
Mine, erm..., sums 10 with 20 in a convoluted manner.
when I was buying food I remembered that I forgot to call SetStreamSourceFreq
17:53
But it outputs 30.
aww, it still doesn't render correctly
fuck you, no Direct3D debug runtime :((
Why aren't you using the debug runtime?
because for some reason it isn't happening, that's why
not because I didn't already spend two days trying to get it working
none of the D3D functions give an error, though
I have already used that handy-dandy-(ewwww macro!) to ensure that
heeere PIXyPIXyPIX
Are you high?
no
oh fucksickles, now I remember why doing this sucks
when you launch from PIX it gives your application a different start directory to normal
or maybe it's when you launch from Visual Studio
but you have to bitch around so it can find your damn shaders
18:02
Use absolute paths.
not helpful if you have to use multiple machines
now my code crashed in some utterly random place which doesn't make any sense at all, even though it executes without any error from Visual Studio
if (!RenderContext)
    RenderContext = std::unique_ptr<Wide::Render::Context>(new Wide::Direct3D9::Context(this, c));
return RenderContext.get();
how can this possibly read a null pointer if this isn't null?
specifically, VS seems to think that the if test is causing a read of null, which seems logical since it's an empty unique_ptr
@DeadMG You can build an absolute path from some known location (app folder, user folder, etc) + relative path.
@DeadMG No, that's not logical. Empty unique_ptrs are fine if you don't dereference them.
well, it does read null, just not de-reference null
But that won't shouldn't crash.
yeah
I got that far :P
18:10
Sure it's not inside the Context creator?
rebuild fixed the problem, so it was no big deal
Xeo
Xeo
@DeadMG VS uses the .sln dir as the root dir, by default. You can change that, however.
considering just using a define, like, #define ABSOLUTE_PATH L"C:\\..."
18:11
yeah
but if I had no macro, I'd have to have a Singleton header to have a constant in
C&C?
@DeadMG ugh how could you even suggest a Singleton?
lol
I didn't, I suggested a macro :P
18:15
Wide::Nasties::PathSingleton::GetInstance()->GetPathRoot()
no
a Singleton header is a header that you include in every file :P
like the Boost configuration header, I guess
I know, but I couldn't resist.
a virtual header is a header that you override via include paths
lol Nasties :P
i have only managed to make that work in three levels
but it helps
18:17
hmm
@CheersandhthAlf Can't you just use a header that "dispatches" with #ifdef?
I think I might have a) submitted some geometry with some bad indexes, and b) put things the wrong way around
0
Q: C++ initialization of global variables

JoshIn C++ what would be the best way to have an object that needs to be initalized in main(), but has to be global, so it can be accessed from other functions throughout the program? And make sure the destructor is called to make sure it gets cleaned up properly?

@RMartinhoFernandes no, that's like browser detection. ungood. brittle. changes means whole system rebuild. so on.
however, did try out macro-based includes.
Of course, immediately someone says "make init() members"
18:19
genarro prota did that first (and better) for Boost, I think it was
but doesn't really work good
so virtual headers are better. they just work. although a pain to set up.
@CatPlusPlus Isn't this paragraph in the wrong place? "You can also use std::reference_wrapper if you don't want to access members via operator->."
anything compiler specific or platform specific goes into virtual headers
@RMartinhoFernandes Maybe.
Guys
litb is to hold a talk
where? when? about?
18:22
@CheersandhthAlf Isn't it more common to use a platform specific cpp file and have that one include platform specific headers?
Congratulations.
@CheersandhthAlf it's in about 10 minutes
in here
18:22
@StackedCrooked yes. i'm not saying anybody else than me are doing virtual headers. yet.
wtf?! I just got -1 for downvoting, how that SO works?
@Abyx That's always been.
Is that your first downvote?
@Abyx i think you can downvote questions without a cost
@Abyx it's your wounded fist xD
right
18:23
first time it always hurts...
note to self:
do not allow your Scale vectors to be 0, 0, 0
because then, everything is 0!
ah... questions, it seems that @Alf is right
Impossible.
i will talk about random topics
18:24
@DeadMG lol
not that it solved the problem
@JohannesSchaublitb That means sex, right?
woah, I didn't suggest it
But you didn't wait a full minute to show up!
Also, I turned in that double pendulum assignment today. Apparently, I've modelled a pendulum high enough to be a skyscraper.
18:25
@RMartinhoFernandes lol
I feel great about not suggesting "sex" but only having the thought to suggest it and then someone else does it for me :)
That was a bit of a derp moment.
@CatPlusPlus TF you talking about?
i think johannes is going to talk about alf's great idea of a "snap-to universe"
@RMartinhoFernandes whoever said I should wait?
18:26
namely, them particles, they just snap to when they get too close to each other
@RMartinhoFernandes I had to write double pendulum simulation. :F
after all, the chance of two infinitesimally small particles colliding, is zero...
I talked about it, you of all robots should remember it.
lol
Arcade Fire is an indie rock band based in Montreal, Quebec, Canada. It consists of the husband and wife duo of Win Butler and Régine Chassagne, along with Will Butler, Richard Reed Parry, Tim Kingsbury, Jeremy Gara, and Sarah Neufeld. Win Butler and Régine Chassagne attended McGill University, where he pursued religious studies and she studied jazz. Arcade Fire came to prominence with the release of their debut album, Funeral, in 2004 to critical acclaim. The band plays guitar, drums, bass guitar, piano, violin, viola, cello, double bass, xylophone, glockenspiel, keyboard, French horn, ...
ok, so
after transformation, all of the vertices are well within the camera's range
the camera's near and far planes are set correctly
18:31
no
although for some reason, some of the colours appear to have had their alphas set to 0?
hi all!
who does work with DNA-PC ?
@user1131997 Is that the hostname?
is this guy that prick who keeps dropping in and asking random CS questions for no benefit and stealing other people's work?
18:34
@StackedCrooked no, it's PC based on deoxyribonucleic acid
@DeadMG is loud and clear again
!
@DeadMG exists
@DeadMG Yes, it exists in non-theoretical-research capacity. Science fiction doesn't even count as research.
18:37
@DeadMG Shapiro made simple finite-state machine, based on DNA
and smth else, who has sovled travelling salesman problem on 2 DNA-molecules
Not in scope: `undefiend'
Perhaps you meant `undefined'
Hmm.
Maybe.
oh cunt
I store my colours in a different order to Direct3D
and I just memcpyd it over
I think
@DeadMG DNA simply often has 4 value ( in exceptio n 5 ), not binary, based on: Guanine, Cytosine, Adenine, Thumine and on chemical reactions mading already calculations, which can solve NP problmes
@DeadMG quantum sucks in Big O notation with DNA-PC
@DeadMG if you have know knowladge , your problem
18:42
> if you have know knowladge , your problem
@alf yes thanks xD
@JohannesSchaublitb It's @Cheers.
@DeadMG if it was problem , I have underline the "?"
Just cleaning up.
:2876833 you gonna do wuwant :)
18:58
You don't need to censor your messages here.
right
something is seriously wrong
the output from my vertex shader should be in HDC and it's not
@DeadMG HDC? you mean the GDI device context?
Homogenous Device Co-ordinates
oh, great, PIX, thank you very much for telling me I'm not allowed to debug my shader because there's an error in the D3D debug runtime
I need to reinstall Windows :(
oh. guess HDC stood for GDI device context two decades ago.
Lol.
GDI contexts are still used, but you don't get the output of shaders via them.
19:06
Typical. One hour of coding and I'm already using five GHC extensions.
@RMartinhoFernandes you use compiled headers?
in Haskell?
damn, another acronym misinterpreted by me...
PCH are precompiled headers.
guess I should ditch obsolete compilers.
19:08
Is there any reason why an input stream will read the last line of my file twice ?
Maybe it likes that line.
@CatPlusPlus I would hope not :)
Its a very simple piece of code ... I see no reason why it should malfunction !! but it is
oh, I never set the motherfucking viewport
@angryInsomniac Bad read loop.
But I'm learning things. Did you know in some old compilers like that Borland shit, you can only declare variables at the start of a function or method. before doing anything else? thank God I live in the 21st century.
19:10
@angryInsomniac it's because you don't check for end-of-stream properly
@IntermediateHacker That's C89.
@Abyx lemme guess while(InputStream) is the wrong way to do it !
@RMartinhoFernandes I'll just pastebin my egregious error for the room to see :P
19:12
@angryInsomniac show some more code
@angryInsomniac Listen to the @Cat.
I'm distracted.
while(/* actual read operation here */)
its 11:13 PM, shouldn't I sleep?
my brain is malfunctioning...
@RMartinhoFernandes & @Abyx pastebin.com/BGkMwvFg
@IntermediateHacker Did your gameboy ever get fixed ? :)
wait, do I even have a brain?
@angryInsomniac no, sadly. :'(
@angryInsomniac Same as usual: the condition doesn't guarantee the next reads will succeed.
19:15
Change to while(stream >> foo >> bar) { /* okay, the two reads succeeded, foo and bar hold fresh values */ }
@angryInsomniac the old SD screen-thing my gameboy used isn't available in the market anymore.
@IntermediateHacker nope ... just a compiler ... or worse :D An Interpreter
@RMartinhoFernandes Hi. You appear to have answered C++ questions not long ago. You probably need to sleep.
19:17
@IntermediateHacker Sad !
@RMartinhoFernandes Umm , I dont really understand that ... any suggested search keyword on google where I can read about it ?
argh
PIX says I managed (finally) to put some stuff onto my viewport
but nothing has rendered :(
1 message moved to bin (No gifs.)
@CatPlusPlus but that gif belongs to the pak army!
11
Q: Why is iostream::eof inside a loop condition considered wrong?

MAKI just found a comment in this answer saying that using iostream::eof in a loop condition is "almost certainly wrong". I generally use something like while(cin>>n) - which I guess implicitly checks for EOF, why is checking for eof explicitly using iostream::eof wrong? How is it different...

It's pretty much the same reason.
19:19
@RMartinhoFernandes Thanks , I shall read that :)
@IntermediateHacker Pak army?
The Pakistan Army (Urdu: , Pak Fouj) is the branch of the Pakistan Armed Forces responsible for land-based military operations. The Pakistan Army came into existence after the Partition of India and the resulting independence of Pakistan in 1947. It is currently headed by General Ashfaq Parvez Kayani. The Pakistan Army is a volunteer professional fighting force. According to the International Institute for Strategic Studies (IISS) it has an active force of 550,000 personnel in 2010. The Pakistani constitution contains a provision for conscription, but it has never been imposed. Since in...
@LucDanton Hmm, I don't understand.
@IntermediateHacker Ah, ok. Not this en.wikipedia.org/wiki/Pak_Protector
@RMartinhoFernandes Looking at your SO activity I simply got the impression that you've been awake for quite a long time lol.
@RMartinhoFernandes lol. :D
19:21
Ah. Yeah. I guess.
I don't feel sleepy. And I think I'm grokking this arrow parser things, so I must still have some wakefulness left.
@IntermediateHacker Of course you know ... This means War ! :D
@angryInsomniac lol.
@IntermediateHacker Coming at you from across the border :)
@angryInsomniac actually, I give up. I've had enough of wars. -_-
@IntermediateHacker I believe homo habilis had enough of wars and we should have given it up then :P
19:24
@angryInsomniac yeah, lol.
@IntermediateHacker What time is it there btw ?
@angryInsomniac 11:25 PM.
and that reminds me, since I'm not an invincible robot, I need to sleep. Bye all!
@IntermediateHacker Whoa ! significant difference ! Here its like 1 ! :)
@IntermediateHacker cya !
only 7:25 here, suckers
@DeadMG PM ?
19:26
@DeadMG you're from Britain?
yep
GMT time... lucky people.
anyway, bye.
aaargh!
0
Q: C++ clean pointer arithmetic

excaliburwhats the cleanest way to perform pointer arithmetic in C++? I am trying to add n bytes to an address. int *foo; foo = static_cast<int*> (static_cast<unsigned int>(foo) + sizeof(T)) Later you could recast and use foo differently char* somestr = reinterpret_cast<char*>(foo) ...

If I have a pointer to an element in a map, what would be the best way to find the key of it?
Element as in mapped_type I assume, not value_type?
19:32
ptr->first?
@Pubby Just to be clear: is the pointer to the pair<TKey, TValue> or is it directly to the value?
Oh, it was to the value. I guess I can just have it point to the pair though
@Pubby But then, why have a pointer? Why not just use an iterator?
Actually wait. I'm using unordered_map and so iterators will be invalidated
@Pubby But so will a pointer
19:34
@Pubby unordered_map has some pretty limited iterator invalidation, IIRC.
If iterators are invalided, so will be pointers to values
And you can't make a pointer to the pair, because the pair doesn't exist before iterating.
What? I thought the values remained stationary
Yeah, iterators are a view into a sequence and depending on rules may only be as valid as the sequence is not altered. Pointers are a view to an element and can sometimes circumvent that. Check the rules.
Pointers on unordered_maps are safe.
> unordered_[multi]{set,map}: all iterators invalidated when rehashing occurs, but references unaffected [23.2.5/8]
19:36
Eh, maybe.
So one last clarification, a pointer to value is always fine but iterator is not?
I'd just use the key, what with this being a mapping and all.
For your container yes.
Ok. I guess I can just store a duplicate of the key in the value then. I only need it for debugging purposes.
19:38
Why not point at the pair? Then you have p->first and p->second.
I thought that gets invalidated :S
No.
A pointer to the pair is not an iterator.
Or use a bidirectional map.
The iterator is invalidated because the iterator tracks where in the whole map structure it is (so it can ++). The pointer can't be ++ed anyway, so it can stay good.
Oh, ok
19:39
There are two kinds of invalidation rules: those regarding iterators, and those regarding pointers/references.
So the pointer/references refers to the pointer to the pair, not the value/keys individually?
Yeah. Pairs store by value, so if the pair moved, the pieces would move as well.
Ok, I understand. Thanks for the help
map.begin() is an iterator to the first element (if present). &*map.begin() is a pointer to the first element. *map.begin() is a reference to the first element.
Can anyone suggest a good simple graphics library ? I just need to display a directed graph on screen with a context menu (for right clicking) , I dont wanna use something heavy which is overkill for such a simple task.
19:51
what's that "an event is starting in Android" thing?
20:12
You can plan events on the chat.
It's a very useful feature nobody really needs.
@angryInsomniac "Simple" and "graphics" are mutually exclusive. Also, no such thing as overkill.
There are no simple UI libraries, because UIs are inherently not simple, and trying to paint them as such results only in an embarrassing failure.
@CatPlusPlus I know ... but the only gaphics library I know is Irrlicht .. 3D graphics lib for displaying a directed graph :P
That feels like overkill
Irrlicht is a game engine, not a graphics library.
You probably want vector graphics, so Cairo or such.
@CatPlusPlus technically a 3D engine
@CatPlusPlus They rarely say "game" explicitly :P
A 3D engine with I/O. So weird.
3D engines are primarily games, and secondarily 3D authoring tools.
20:17
semantics ! Anyway , thanks for the tip on cairo , looking that up
Ell
Ell
20:30
hi guys
hi
!y
Do you know how I can download Xcode for my mac version 10.6.8
20:41
@ScottW I'll check the cd as the latest version on that site does not work for 10.6.8
thanks
> error: reference to '_1' is ambiguous
Thanks Boost.
@ScottW it does not seem to bee on the cd - do you know which version of the xcode from the website would work on my mac version?
Greetings and salutations.
Okay, who knows C#. Can I do an equivalent of template <typename T, typename... Args> T make(Args&&...) { return T(std::forward<Args>(args)...); }?
@CatPlusPlus If you were to explicitly code every arity up to a pre-defined for Args
and remember to qualify for T
20:52
I see they have params keyword for variadic functions, but now what about unpacking that into a constructor.
no idea
Oh, hey, reflection.
Oh, God, reflection.
Are you cereal.
I'm eating Cheerios!
20:56
lol
reflection rocks, though
> In computer science, reflection is the process by which a computer program can observe (do type introspection) and modify its own structure and behavior at runtime.
Whyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy?
Code is data.
@CatPlusPlus Manually?
Just because it's possible doesn't mean it should ever be necessary.
reflection is an excellent tool
20:57
Besides, there were self-mutating assembly programs long before high-level languages.
And that's terrifying.
@Maxpm It's useful.
Otherwise nobody would bother.
@RMartinhoFernandes Might as well not bother then. :P
When would one want to circumvent having concrete behaviors for parts of a program? Surely, that is one of the major benefits a programming language should provide.

« first day (509 days earlier)      last day (4661 days later) »