« first day (560 days earlier)      last day (4388 days later) » 

2:00 PM
I was quite impressed with boost phoenix though.
auto D = b * b - 4 * a * c;
Defines a functor to calculate the discriminant for a 2nd degree equation.
It just magically worked.
 
lambdas are better
 
But not as neat.
Honestly I find lambda's to be a little clumsy.
 
user784668
@StackedCrooked but they don't need half an hour to compile.
 
Using lambda's is more likely to lead to code duplication than functors.
@Fanael Don't know how lambda's compare in this regard.
I like thinking in terms of g ○ f. I guess that makes me more of a functor guy.
Phoenix functors seem compile really slow though.
 
@StackedCrooked Are you sure it can safely be used with auto?
 
2:08 PM
Ew, I just wrote this horrific line of code. Anyone an idea to make it better?
auto user_data = reinterpret_cast<CXClientData>(const_cast<std::function<void(const entity::Entity&)>*>(&callback));
 
user784668
@StackedCrooked Like all template metasturbating.
 
@LucDanton I don't know. In the documentation auto was never used. The expression was also never stored, but rather passed to a stream or something.
 
user784668
wut?
 
2:08 PM
@classdaknok_t It's hard to tell what you are doing here. But perhaps the target member of std::function would be of help?
@StackedCrooked By default Boost.Proto creates EDSLs that are unsafe with auto but I don't know if Phoenix went with that. It's possible to change that behaviour.
 
In the docs it was always directly bound to it's usage. E.g:
std::for_each(v.begin(), v.end(),
    if_(arg1 > 5)
    [
        std::cout << arg1 << ", "
    ]
);
 
@LucDanton I'm using libclang to iterate over all AST entities. Callback is of type const std::function<void(const entity::Entity&)>& and I need to pass it to a function clang_visitChildren as a CXClientData like this: clang_visitChildren(clang_getTranslationUnitCursor(tu.tu_), &visitor, user_data);.
 
@classdaknok_t What are the odds that the reinterpret_cast gives a useful result?
 
So the only option I saw was combining a const_cast and a reinterpret_cast.
@LucDanton I cast it back to the original type, so the reinterpret_cast would be safe, I guess?
 
@classdaknok_t Can't tell without knowing what CXClientData is.
 
2:12 PM
void*.
What else.
 
CXClientData is void*, yes. :P
Here's some more context: gist.github.com/2519365.
And yes, I do take std::function as a parameter but it was really the only option I saw since I'm using pimpl (and hence I cannot use a template).
 
Then yes, it's fine. Although you can use a static_cast rather than a reinterpret_cast. And don't forget to restore the const qualifier when restoring the original type.
 
Oh how I love using C APIs.
@LucDanton I make it const like this: const auto& callback = *reinterpret_cast<std::function<void(const entity::Entity&)>*>(data);. Is that good, or do I need to const_cast it back?
Everything works, but I want to make sure I'm not in UB land.
 
Make that a static_cast as well.
 
2:16 PM
And restore that const qualifier.
 
@LucDanton I do that, I assign it to a const auto&.
Oh wait you mean before dereferencing?
 
Yeah you can static_cast to the desired type in one go.
 
*static_cast<const std::function<void(const entity::Entity&)>*>(data)?
 
void* -> T const* is fine.
Yes.
 
Thanks for the help.
imma exchange teh batteriez of mah mouse
 
2:19 PM
You could have saved yourself the pain of the const-mismatch by taking a copy of callback though (or changing the parameter type, if you have control over that). Then it's a matter of static_cast back and forth to and from void*.
 
Wee, taskbar crashed.
 
Why are you using Linux?
For Clang?
 
Wee, taskbar crashed again.
 
@StackedCrooked who is you?
 
2:22 PM
You don't have to use the statements of Boost.Phoenix tbh.
 
@StackedCrooked What's the fucking point?
 
It looks so weird.
And here I used to think Duff's device was nifty.
It's going too far man :)
I like Boost, don't get me wrong. But sometimes...
 
Don't want it don't use it.
 
Sure.
 
I like Boost too! Especially its documentation.
 
2:25 PM
I remember a colleague refusing to use boost::bind because he didn't like the global placeholders (_1, _2, etc..). (That was back in 2005 though.)
 
@classdaknok_t The point is to define a lambda. Expressionising statements helps.
 
@classdaknok_t Do you find that boost docs are lacking?
 
I don't know of any documentation that's not lacking ...
 
@StackedCrooked I find them difficult to navigate and search through. Maybe I should put more effort into browsing them.
 
@CatPlusPlus I do think that this is not something that can be easily stepped through with a debugger at runtime.
 
2:28 PM
Let's try.
 
Nothing from Phoenix probably is.
 
Yeah, I could be wrong.
 
Should I try to add RAM indicator to the taskbar again, or will it crash again?
 
Perhaps it's just a matter of getting used to it. Just like it took a while before boost::bind started to feel like nothing special.
 
user784668
@StackedCrooked True Programmers don't need no stinky debugger!
 
2:31 PM
@Fanael Good for you :)
 
user784668
@StackedCrooked I'm not a True Programmer.
 
You're a fuzzy one?
 
user784668
I'm a Schrödinger's programmer :P
 
Btw, Duff got a Wikipedia page.
So that's yet another way to get in.
@Fanael You should do quantum computing then.
 
2:35 PM
@classdaknok_t Dammit that's annoying.
 
@StackedCrooked Works.
 
The most difficult part of my documentation generator is generating the file names of the HTML files and make sure there are no clashes.
Meh name mangling.
 
@classdaknok_t That's the hardest part?
 
Until now, yes.
 
2:37 PM
It's the first part perhaps? :D
 
Maybe clang provides something, that would be cool.
@StackedCrooked nope. :)
 
Doesn't it report mangled names?
Well, it might not.
 
Oh thank God clang_getCursorUSR exists.
 
I haven't reimplemented the statement-oriented parts of Phoenix. I feel like the odds where I need to write a polymorphic functor that can e.g. handle exceptions inline are really low.
 
In USSR, cursor gets you.
 
2:39 PM
using clang.
 
Plus it's not like I can't use Phoenix itself.
So really, the odds of having to write a polymorphic functor that can handle exceptions and let's say move-only types.
 
Perhaps it would be more efficient to emulate something like Haskell's Maybe.
 
I'm surprised that this is valid C++ code: int $foo;.
 
user784668
It's not.
 
c++Query!
@Fanael it compiles with -pedantic.
 
2:40 PM
4
Q: Are dollar-signs allowed in identifiers in C++?

GiliWhat does the C++ standard say about using dollar signs in identifiers, such as Hello$World? Are they legal?

 
Standard specifies minimal character set, apparently, and implementation can allow more.
 
Yeah but this is new from C++11. That's a 2009 question.
 
void $(const std::string& selector) I'm feeling evil!
 
$(eval "std::cout << \"Hello World!\"")
 
I've just eaten a bag of crisps.
 
user784668
2:42 PM
void _(const std::string& selector) is just as evil.
 
_ is used with gettext often.
 
user784668
Aye. It defines _ as a macro though, right?
 
@StackedCrooked I was thinking about stealing $ for a better preprocessor.
Yes.
 
int $100 = 100; get_money($100);
 
It would be nice if certain invisible unicode symbols could be used for names. For hiding implementation details.
 
2:44 PM
Xcode has problems with highlighting the identifier.
 
Impossible.
 
Possible.
 
Stop negating people.
 
user784668
Don't stop negating people.
 
!people
 
2:48 PM
At least be lazy and create a functor that you can save for later.
!bind(people)
Which probably doesn't work in C++11 implementation of bind..
 
user784668
@classdaknok_t <stdin>:1:1: error: no match for 'operator!' in '!people'
 
auto func = &*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&puts; function pointers are fun!
 
user784668
auto func = *********************************************puts;
 
@Fanael what horrible compiler are you using?
 
user784668
@classdaknok_t GCC
 
2:51 PM
It doesn't even mention that people isn't declared.
 
auto func = +puts;
 
user784668
@classdaknok_t It doesn't, because it is declared.
 
Oh xD
 
@classdaknok_t So I get that you understand deref and address-of now?
:D
 
I already did, to be honest.
 
2:52 PM
If all you have is a hammer.. :p
 
I was a C fanboy in the past and I always hated C++. :P
 
user784668
@classdaknok_t Now you're not a C fanboy anymore, but you still hate C++ :P
 
Until once I saw that you can concat strings using + in C++ and ever since I hate C.
@Fanael if you don't hate C++, you haven't got enough experience with it.
 
user784668
@classdaknok_t I know.
 
Me too.
 
2:54 PM
@classdaknok_t I wanted to learn C++ because that seemed to be the only real language. The other ones like VB, Pascal, Java seemed "fake".
Because you need an environment, and can't do everything.
 
I wanted to learn C++ because I could worry less about low-level details and memory management.
 
I learned C++ because that's what they taught in college
 
At high school they taught Visual Basic, Java and PHP, so I learned Haskell.
 
@classdaknok_t I recently had a brief look at a book on threading with POSIX. It said that recursive mutexes should not be used and that they are like a nightmare waiting to happen. The reason being is that you must unlock the mutex exactly the same number of times that the mutex was locked. And it's very likely to sometimes get that wrong.
 
@StackedCrooked use std::mutex. No need to worry about low-level details.
 
3:00 PM
@classdaknokt Yes. That's very amusing to read if you are a C++ programmer.
 
user784668
Is there a POSIX API to read and write other processes' memory?
 
std::mutex is not recursive.
 
std::recursive_mutex
 
Which is as low-level as POSIX one.
 
The difference is made by RAII.
Which actually is a higher-layer abstraction over manual locking and unlocking.
The funny thing is that this problem which has apparently haunted unfortunate C developers for ages simply doesn't exist in C++.
Assuming the programmer isn't a total idiot.
 
3:03 PM
Mutexes are still low level primitives.
 
Yeah. That's not what I'm trying to say.
 
Sure, we have RAII, but you still can deadlock easily. :P
 
Lock the dead!
I watched a video today about threading in C++11, by the way.
 
The funny thing is that once I started my project with the intention to become familiar with threads, mutexes, etc.. I ended up writing a "Worker" and "WorkerPool" classes and ended up with something what I later learned was called Task-based concurrency.
It doesn't make sense to create a std::thread every time you need to do something in the background.
The book C++ Concurrency in Action looks very interesting. Albeit a little dense.
I wonder if it would be ok if I spent a certain percentage of my working hours reading relevant technical books.
 
3:13 PM
Johannes!
@JohannesSchaublitb what's your opinion on using recursive mutex if I may ask?
 
i have no clue
IMHO recursive mutexes smell tho
 
I fear that not using them will lead to occasional deadlocks when one function calls another function and they both need to lock the mutex.
But in C++ Concurrency book Anthony William writes that using recursive locking is sloppy.
 
@StackedCrooked (Reading books during worktime) -> I reckon that's legit. It's not like it's possible (at least for me) to be writing code for 8 hours straight.
 
Yeah, that's right.
I should have use ebooks that I can read while compiling :D
 
I can usually code max 3 - 4 hours straight ...
then i need a pause
(unless i'm doing real shit like pasting snippets around ...)
 
3:20 PM
Same for me. If I code longer than that I get tunnel vision and start to tweak console output alignment instead of thinking.
 
yeah i start doing random stuff too
i mean, i could code next 4 hours straight but it would be ... well, shit ...
 
The trick to improve your coding is to stop more often :)
 
@StackedCrooked Yeah possibly, i mean, im usually ok with the stuff i write, but there's so much room for improvement ... :)
 
Learning C++ is like studying the Lord of the Rings universe.
Once you got the basic story you still know nearly nothing.
 
Yeah, i came from C and my C++ code first few months was basically ... C with occasional std::vector<> for convenience.
 
3:25 PM
Today, I decided to get rid of some old hardware on eBay. After only a few hours, I already sold two DDR2 memory kits :)
 
Oh, and i like the idea of stream I/O instead of silly printf() with silly ellipses.
 
@FredOverflow Never used eBay. Bit it does seem like an interesting option to get rid of some of my stuff.
I have a few old machines that are gathering dust.
 
@ScarletAmaranth a type safe printf using variadic templates is quite cool, though.
 
user784668
Type-safe printf > operator <<.
 
@StackedCrooked You have to decide for yourself if it's worth the effort (putting it up on eBay, package it up nicely, go to the post office etc.). I bought 2 GB of ram in 2007 for about 100 Euro and sold it today for 10 Euro.
 
3:29 PM
If implemented using streams, you can even use it with custom classes that have operator<<(std::ostream&, const T&) overloaded.
 
@FredOverflow That's quite lousy imo.
 
Well, it's how much DDR2 is worth today.
 
@FredOverflow That's ok Fred, i wasted 650 on 5970 2 years ago, i think i'd get maybe 50 for it today :)
 
either I’m too stupid for the 21st century or Android really needs to rework their UI
 
user784668
@classdaknok_t that's the best of both worlds.
 
3:30 PM
I’m not able to add a phone number to an existing contact …
 
@ScarletAmaranth Speaking of graphics cards and eBay, my 5670 just arrived, bought it for 35 bucks :)
 
@FredOverflow But 10 EUR isn't really worth the effort and packing/sending cost.
I would throw the DDR2 off my balcony when nobody is watching.
 
@ScarletAmaranth My most expensive graphics card I bought more than 10 years ago, can't remember what it was. Bought it for 700 DM (350 Euro) and sold it five years later for 5 Euro :)
 
350 / 5 = 70 EUR per year.
 
3:32 PM
@StackedCrooked I simply can't throw stuff away if there's somebody out there who might still have a use for it.
 
@FredOverflow :) I cashed 650eur for the most expensive GPU i've ever bought and i play Plants vs Zombies on it :)
 
I have a nothrow guarantee, if you will ;)
 
<- idiot
 
i will throw him anyway
 
Oh, not to mention that whenever you buy the shiniest new GPU, you have to wait 6 months for the sodding thing to actually work. (Driver issues)
 
3:34 PM
Throwing things is quite exceptional.
 
@ScarletAmaranth I am currently using my onboard X4500 graphics and it's doing just fine, but I thought hey, a 5670 for only 35 bucks, it's a no-brainer :)
 
Ah yeah, nothrow, yet another thing that I should educate myself about.
 
@FredOverflow Oh well, it was fun to overclock :)
 
@ScarletAmaranth I have grown out of overclocking since I stopped playing games.
 
As long as my GPU can handle Minecraft it's fine. :P
 
3:35 PM
Today I have a Core2Duo (1800 MHz) automatically underclocked to 1200 MHz most of the time.
 
@FredOverflow It's also fun to see it draw 250Watt (while NOT idle ofc)
 
@ScarletAmaranth How do you see it, do you have a Wattmeter?
 
@FredOverflow Yeah i do.
 
cool
 
@FredOverflow Oh well, it's all big and nice and shiny, i guess that's a plus too :)
 
3:36 PM
@ScarletAmaranth what company is it?
 
@JohannesSchaublitb Gigabyte
 
the wattmeter, i mean
 
@JohannesSchaublitb Let me check.
@JohannesSchaublitb Can't find it, will find you a link for it.
 
I don't think it even has a "brand" :)
 
3:41 PM
Cool language.
 
Just another generic Slavonic shit :)
I wish i were a native English speaker :(
(With Posh accent ofc, like a sir.)
 
Start with writing "I" with a capital letter. :P
 
user784668
@ScarletAmaranth Slavic. FTFY
 
Thanks :P
 
No problem.
 
3:49 PM
thanks dude
 
Problem.
 
Why is the keyword virtual required if i mark something already with foo() "= 0"; ?
 
Fucking good question!
Probably historical reasons?
 
user784668
Why is the int keyword required if main returns int anyway?
 
I have no clue, i've just forgot to say virtual foo() = 0; I typed void foo() = 0 and compiler was complaining that it works only on virutal functions.
I mean duuuh, ofc ...
 
3:54 PM
Because the function is pure virtual, not just pure. :P
 
@Fanael because you one-time-pass compile ?
 
@classdaknok_t D has non-virtual pure functions, but "pure" means something different in D :)
 
user784668
@ScarletAmaranth So?
 
Haskell too.
 
@classdaknok_t But Haskell doesn't need a keyword for pure functions ;)
 
3:56 PM
Oh haskell, my hatred towards you shalt ne'er fade ...
 
True.
 
How can you hate Haskell?
 
Like this: " FU Haskell ".
 
Haskell is the best thing since C.
 
Why doesn't C++ have a logo? :(
 
3:57 PM
>lambda=
@FredOverflow because C++ sucks.
 
@classdaknokt O_o BLASPHEMY!
 
@classdaknok_t C++ sucks because it has no logo? Yeah, right :)
 
@FredOverflow no, C++ has no logo because it sucks.
 
@classdaknok_t right, brain fart on my side
 
"Brain fart" sounds so nasty.
 

« first day (560 days earlier)      last day (4388 days later) »