« first day (527 days earlier)      last day (4424 days later) » 

10:00 PM
"What do I know"
 
I think, about my example, that Microsoft's DWORD_PTR type is sort of in conflict with itself: DWORD says it's fixed size, 32 bits, while _PTR says its of platform-dependent size, same as pointer
 
@Beginnernato: You're asking questions that can be easily answered by looking up the documentation for scanf().
 
It's an expression.
 
@CheersandhthAlf Sweet Jesus. That's overkill. And depends on following with ;. You can get very silly stuff now with:
CPP_DECLARE_UNUSED( subclassId )
{
    ~subclassId() { std::cerr << "fun!\n"; }
} x;
 
10:00 PM
@CatPlusPlus I know, you missed my (not so) cleverness here.
 
That suits the hack perfectly.
 
@sehe Don't ask me, I didn't make it. I'm just the messenger.
 
Even better:
 
CPP_DECLARE_UNUSED(subclassId) { ... };
subclassId foo;
 
10:01 PM
@Insilico thanks
 
@sehe is is always so with macros. any macro can define its own mini-language. abuse at own risk.
 
@RMartinhoFernandes Sorry, misdirected response again
@CheersandhthAlf But you can prevent it. Just incorporate the darn ; into the macro. Job done.
 
What about blah blah; struct foo; do { } while(false)?
 
Rawr, moar macro hacks.
 
@RMartinhoFernandes Won't work, the struct will be limited in scope
 
10:02 PM
Yeah, but the other DECLARE macros require terminating semicolon, so it's for consistency...
 
@sehe Yeah, noticed that.
 
Oh, I can do it! Thanks!
 
@CheersandhthAlf What ever is wrong with ; (void)0?
 
Also, you might want to add that 'avoiding overloads' thing to tips & tricks.
 
10:03 PM
Yay, I made someone make a contrived MACRO even more contrived. My life has a purpose again
 
@sehe CPP_BLAH_BLAH(sdfsdfS) + bad_stuff()
 
@sehe if followed by x might be misinterpreted as hex?
 
@CheersandhthAlf BrokenBeyondRepair(TM)
OMG: Bruces Schneier posting some bomshell material here: schneier.com/blog/archives/2012/03/congressional_t.html
 
#if !defined( CPP_DECLARE_UNUSED )
#   define CPP_DECLARE_UNUSED( argName )    \
        (void)(argName, void(), 0); struct argName; (void)0
#endif
 
10:07 PM
 
But what the hell is wrong with removing the name of the parameter?
 
^ Thanks to all you folks: johannes for op comma solution, r.martino for pointing out op void() problem, sehe for pointing out semicolon problem.
 
Using that macro is not only hacky, it's more verbose.
 
Again, what's wrong with using /* */ to comment out unused parameter names?
 
@Insilico they don't nest. so it's a problem for people who want to comment out code.
 
You don't need to nest them for parameters, no?
 
@CheersandhthAlf I think the old do {} while(false) thing is safer than (void)0.
@Insilico /* void f(int /* bar */) {
 
@EtiennedeMartel Nothing. But the macro can be used for local variables as well. Useful in testing
 
@RMartinhoFernandes possibly, but might generate warning with stupid compiler (read: visual c++)
 
10:11 PM
Sigh.
 
 
It just gets to a point where you're spending way too much time with something that should've been done with hours ago
 
@sehe That's no fun.
 
@sehe is that game screen or hubble deep view?
 
It's from VISTA.
 
10:12 PM
@CheersandhthAlf: It's from ESO
 
European Southern Observatory’s Visible and Infrared Survey Telescope for Astronomy
 
very blue, young galaxy?
 
@CheersandhthAlf: Well, it's probably really old now (because those galaxies are millions of lightyears away)
 
It's still kind of trippy to know that what you're seeing in the night sky is essentially a photograph of what happened many, many years ago
 
10:14 PM
@RMartinhoFernandes convert eso1213a.jpg -resample 5% test.png in 17s was a nice benchmark
procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa
 1  0      0   6015      4    602    0    0  5928     0 1316 3285 19  2 77  1
 1  0      0   5889      4    602    0    0     0   100 1055 3109 29  4 67  0
 1  0      0   5760      4    602    0    0     0     0 1035 2888 30  6 65  0
 6  0      0   5632      4    602    0    0     0    36 1716 7013 42  4 54  0
 6  0      0   5503      4    602    0    0   264   128 1069 3047 30  5 65  0
 
@sehe But that picture is dull and boring.
The original one has 200000 galaxies for you to discover. The resized one has nothing.
 
@RMartinhoFernandes Don't look at it! Bin it!
 
Dammit, okular can't zoom past 40%.
 
@RMartinhoFernandes You use Okular for viewing images? I'd use it for PDF, vector stuff
 
@sehe I didn't bother installing anything to view images.
I rarely need to view images outside a browser.
 
10:17 PM
@sehe: It is, as they say, "more than a reader"
 
@RMartinhoFernandes eog goes to 2000%
My tool of choice would be Gimp. It was quite responsive in panning/zooming
 
i used to use imagemagick for resampling etc.
but that was long ago
very impressive images from that telescope
 
spaces in input... how do you store specific things that are seperated from the spaces ? :S
 
Again, I don't want to resample. Just zoom.
 
@Beginnernato that question doesn't make sense. Try again.
 
10:22 PM
@Beginnernato std::string a,b,c; std::cin >> a >> b >> c; <-- in fact yeilds space separated stuff
 
@sehe he's still working in C, not C++
 
@CheersandhthAlf convert is from imagemagick
@MooingDuck Oh. That.
 
@MooingDuck well i want to check if the input is "score", so i can store the next 2 things in an array. if(s == "score") doesnt work ...
 
Didn't your teacher cover this?
You need to use strcmp.
 
10:24 PM
@Beginnernato if s is a pointer, then == will compare pointers. You want to use a function to compare what the functions point at. You want strcmp
 
@RMartinhoFernandes ohhh ... yes sorry i totally forgot
 
It's amazing how bad people can be at communicating when trying to post on a damn forum.
I mean, it doesn't take a genius to know others can't answer what they can't understand.
 
@CatPlusPlus: Well, I see lots of people answer things that they don't understand either
And miserably failing in the process
 
if (strcmp(s,"score")){
  r = scanf("%20s%d", (char*)readin[i].name, &readin[i].score);
  i++;
  }
 
strcmp returns 0 on equality.
It's funny how you spot these kinds of problems immediately.
 
10:37 PM
but s will be "scorebetty10"
 
Then use strncmp.
 
or something like that ....
 
strcmp will tell you nothing when comparing substrings.
if (strncmp(s, 5, "score") == 0) { ... } // don't remember the argument order, go look it up
 
but umm the question is will r store the "betty10" accordinglt in the array ?
 
scanf returns number of fields that were read.
Also, don't add casts blindly to shut the compiler up.
 
10:40 PM
so readin[i].score wont be 10 ?
 
This scanf call will segfault.
 
readin[0] *
hmmm alrite, thnks
 
You need buffer with preallocated memory for the string.
 
Ppls, good night
 
And now, what the hell was ConstructionVisitor for.
This codebase is full of Fun.
 
10:41 PM
@sehe Good night.
 
night :)
 
#include "iostream" yay.
 
The hell is #include "iostream" for?
They have a file called iostream somewhere in their project directories?
 
10:44 PM
If you changed it to #include <iostream> do you get any problems?
 
Then that's just... odd.
 
You don't say.
Also, aggressive refactoring is fun.
Negative LOC yay.
I just read Game::FlipBuffer as Game::FlipBurger.
 
10:47 PM
@RMartinhoFernandes Command & Conquer?
 
Dammit, I have to look it up every damn time.
 
Who reads USENET posts with a cat on their lap?
 
I look at my old code and shiver.
 
@Insilico Blofeld.
 
10:49 PM
@CatPlusPlus Yeah. Same here. My old code is filled with Hungarian notation.
 
ggdG.
 
Ow.
That's drastic.
 
Desperate times.
In reality I'll leave the top comment, with licence and whatnot.
 
I don't ever remember using Hungarian notation
 
10:50 PM
The rest is better off dead.
 
Thankfully, I moved on, and now I use the STL/Boost convention: underscores everywhere!
 
It just seems like a lot of typing for no good reason
camelCaseForTheWin
 
@EtiennedeMartel snake_case.
 
CamelCaseForAllTheClassesAndFunctions
 
Camel case stands out in C++ code.
ThisIsPascalCase.
 
10:52 PM
PascalCaseForAllTheClassesAndFunctionsThen
 
UNDERSCORES_FOR_THE_EVIL_MACROS
 
Underscores for the underscore god.
 
Mixed_Camel_Case_And_Underscores
 
Now that's fugly.
 
10:54 PM
(although I've never seen anybody actually use that)
 
@CatPlusPlus fyi: I gave him that line. It doesn't segfault because name is a char[21]
 
Now here's a mystery: why some of the private members are prefixed with _ when most of them are not.
 
This code I'm writing has more macros than code x_x
 
@MooingDuck Why cast then?
 
@Pubby: Are we talking about the dreadful message map business? XP
 
10:55 PM
@Insilico What's that?
 
Wait, is everyone here trapped in crappy code?
 
@Pubby: If you don't know what it is, that's a good thing
 
@CatPlusPlus I had another error that made me think it was needed. It isn't.
 
You know what's the best part? I can't break compilation, because there's no build system!
 
@RMartinhoFernandes due to LearningC/Beginnernato's homework yet
 
10:56 PM
facepalm
 
Oh, this is this guy again?
 
@CatPlusPlus yeah
 
Is he a help vampire?
 
@RMartinhoFernandes yes, but he only asks in chat
 
Let's wall him in.
 
10:56 PM
MFC's message map macros are the most dreadful thing to ever happen in any C++ library ever
If you can call MFC a "C++ library"
 
And then wxWidgets went and did the same thing.
 
@Insilico Oh gosh noes.
1 message moved to bin
Phew.
 
@Insilico Nah, these are My Own Macros.
 
> wxWidgets has an event system similar to (but more elegant and powerful than) MFC's message maps, that allows events to be associated with member functions either statically (at compile time) or dynamically (at run time).
(yeah, right)
 
@Pubby: What's all the macros for?
 
10:58 PM
@Insilico I've always wondered what demonic sacrifices made the thing work. Someday I'll get the guts enough to look and find out
 
@MooingDuck: Oh for the sake of humanity don't. I've tried that and I almost stabbed my eyes out
 
@Insilico Dunno if you saw that code I pasted yesterday, but I'm trying to reduce some OpenGL mess so I don't repeat myself 10 times
 
Maybe OpenGL's shitty C interface is the problem? :-P
 
Ya think?
 
11:00 PM
Meh, the only problem with GL interface is error reporting.
And ARB_debug fixes that.
 
@Pubby: Good luck with that.
 
Oh, hey, NPC::Think uses goto.
Thankfully only for loop escaping.
12 levels of indentation.
 
Holy shit
Surely some of it can be factored out into several functions?
 
I'm saving this one for... later.
 
@CatPlusPlus You suck at making up jokes.
 
11:04 PM
True story.
 
I refuse to believe it.
 
We're talking about a function that's ~800 LOC-long
 
That's 600 LOC too long
Factor that shit.
 
You can count the tabs. I did.
 
> //TODO split that monster into smaller chunks
 
11:06 PM
@CatPlusPlus Woah, you hacked bitbucket!
 
I'm currently busy ripping out Boost.Serialization and libtcod parsing code.
 
(That's the only logical explanation)
 
The damn parser uses type punning and breaks on 64-bit builds.
Stupid C programmers.
shakes fist
 
I admit, the goto is totally justified.
 
In that context shooting yourself in head is totally justified
 
11:09 PM
hi all! :)
 
return name + " was barbecued by" + otherName;
 
Hi @user1131997
 
@CatPlusPlus WTF is that?
 
Death messages!
 
Quick question … does C++11 contain the equivalent of boost::recursive_wrapper with a constructor that forwards the arguments or do I have to resort to std::unique_ptr?
 
11:10 PM
(Also, did I mention this game produces 20MB saves?)
 
> But, learning a proper imperative language like Java or C/C++ (or even Perl and PHP) is the only way for a new programmer to explore logic itself, and not get too bogged down in architectural concerns
 
@CatPlusPlus So? DF saves are more bigger.
@Pubby Fuck that. Beginners need to learn monads and STFU.
 
DF saves don't repeat item names 10000 times.
 
I've reduced NPC.cpp to only 97kB!
 
11:11 PM
@KonradRudolph: Not that I know of.
 
pity, I thought so
 
"A plug-in used to perform Search is missing. Please reinstall Acrobat"
The fuck you say, Acrobat?!!
 
@RMartinhoFernandes Yeah, right after they finished category theory
 
What's category theory?
 
11:13 PM
Apparently restarting Acrobat fixes it for some WTF reason
 
@Insilico Now you can search, now you don't.
It's your punishment for using Acrobat.
 
Nope, the C++11 draft doesn't have a recursive_wrapper anywhere
 
Yes, I had hoped that it perhaps occurred under another name
after all, recursive_wrapper is far from intuitive
 
std::fluffy_bunny
 
it’s a bit like RAII …
a better more descriptive name may be incomplete_type_wrapper or something like this …
 
11:15 PM
@KonradRudolph can you use perfect forwarding? (I'm speculating that's more or less what recursive_wrapper is for by the context)
 
@MooingDuck I want perfect forwarding, boost::recursive_wrapper doesn’t have an appropriate constructor
the only think it has is a constructor taking T const& and copy constructing from that
 
Ooh, I remembered another fun fact about the game logic. Reliance on dtors to run in specific times while using shared_ptr.
 
Boost is severely lacking in the rvalue ref department.
 
A thing like recursive_wrapper doesn't sound like something that would be included in the C++ standard
 
@RMartinhoFernandes Well, no wonder. It precedes C++11
in fact, I think rvalue references came about as a consequence of some Boost libraries and the inherent inability to express certain concepts
 
11:17 PM
What are they waiting for?
 
boost::scoped_ptr etc.
@RMartinhoFernandes Uh … you? ;)
 
They already have emulation for old compilers in Boost.Move.
 
@RMartinhoFernandes QA I'd assume
 
Cute. A ctor that calls Init and nothing else.
 
You can just hack something togeather for recursive_wrapper based on a unique_ptr.
 
11:18 PM
@MooingDuck Yes, of course :) It’s actually pretty trivial
 
@CatPlusPlus: Is Init() a private function in the class?
 
Hell knows. I haven't looked at headers yet.
 
Still a WTF either way
 
I've wondered, how much potential would there have been for badness if unique_ptr had a copy-ctor that simply made a copy of it's data? That would make it a lot more useful for holding member data I'd think, and it's not like people would be making copies of local unique_ptr's left and right.
(wait, can you copy a unique_ptr?)
 
11:20 PM
There's proposal for deep-copying value_ptr.
 
**unique**_ptr?
 
@MooingDuck No.
 
@MooingDuck: That would kind of defeat its purpose
 
ah, fork this
 
@Insilico not if it did a deep copy
 
11:21 PM
Markdown claims another victim.
 
@CatPlusPlus I want that. I can't think it would cause more problems than it would solve.
 
Presumably unique means "there's only one of these"
 
Of course, they can't add it in now, it's too late :/ We need a new type now.
 
Not "there's only one of these but there might be copies of it someplace else"
 
@Insilico unique means there's one owner.
 
11:22 PM
I agree, that was a straw-man
 
@MooingDuck: I see.
 
still, you can just use copy assignment of its dereferenced value, no?
 
> What color should the bicycle shed be painted?
 clone_ptr
 cloned_ptr
 cloning_ptr
 copycat_ptr
 copied_ptr
 copying_ptr
 deep_ptr
 dup_ptr
 duplicate_ptr
 duplicating_ptr
 matched_ptr
 matching_ptr
 replicating_ptr
 twin_ptr
 twinning_ptr
 
11:23 PM
@KonradRudolph if you have an object that has a unique_ptr member, you must write a copy constructor, with potential for error. If it was copiable, it's magic
 
@MooingDuck Good point
 
@Insilico true, but I would have liked to have the option. Where did you get that list?
 
I’m guessing that they don’t have it since the semantic would be slightly unintuitive
 
Pay attention.
 
@MooingDuck: In the open-std.org PDF Cat Plus Plus linked
 
11:24 PM
for any other pointer, when you assign/copy it, the pointer is copied, not the pointee.
 
@CatPlusPlus it's still loading. Or it failed to load, one of the two
 
There's one implementation in the paper, and another in that repo.
 
The standard tries to avoid inconsistencies whereever possible. Same reason why shared_ptr is always thread-safe, even though it costs extra
 
@KonradRudolph fair enough.
 
Because there couldn't be shared_ptr and shared_ptr_ts, noo.
 
11:26 PM
Ok, this discussion is actually pretty interesting but I really need to go to bed
so, good night fair people
 
We're not fair, we're insane.
4
 
> I need to implement code from the .h file into the main.cpp file
Where do people learn to speak like this?
 
It's "trying to appear clever" syndrome.
 
Presumably it means "I need to provide definitions for all the declarations in my .h file and put said definitions in a .cpp file"
Or something
 
@CatPlusPlus Actually INSAAAAANE would be more accurate.
 
11:56 PM
hmm
need to remove from octree by value...
 

« first day (527 days earlier)      last day (4424 days later) »