« first day (442 days earlier)      last day (4492 days later) » 

Xeo
4:06 AM
Meta debugging is what I call that. :)
 
Predicate classes sound cool.
 
4:22 AM
@Xeo this means operator->() is merely forwarding operator*(), pardon me being slow here.
 
Xeo
@wilhelmtell Well, yes, but the return value (proxy) of operator->` is implicitly created from the return value`operator*`, as such it's not that simple of a forward.
You can write it as proxy operator->(){ return proxy(**this); } if that helps
 
oh you mean operator*() doesn't return a proxy, but what the proxy wraps, by value.
 
Xeo
correct!
That would be the best way atleast, imho
 
but then, when does the proxy's operator->() gets called? X x = *i; calls the iterator's operator->(), and then the proxy's operator X&().
 
Xeo
No, X x = *i; calls operator*()
 
4:29 AM
sorry
yeah
i'm tired.
 
Xeo
it->some_func() would first call iterator::operator->, then proxy::operator->
And finally the member function of X
 
yeah. operator->() in C++ is vague, i find. the way it works with udt.
it boils down to operaot->() returning a pointer, which i don't thoroughly understand why. The Standard Said, i guess.
 
Xeo
It wouldn't make any sense otherwise
 
well
 
Xeo
Because you'd need to know the type of a member referred to by x->m
And you'd need to get some kind of pointer-to-member passed to actually select the correct member and everything
It would be way more complicated
 
4:32 AM
it->do_stuff_with_pointee(). if oper->() would return a reference, what' wrong with do_stuff() being called on that?
 
Xeo
Something like the voodoo you need for operator->*
It's not the usage that is the problem, but the implementation
 
yeah
 
Xeo
How would operator-> look like (return type, parameter list), if you wanted to be able to access anything with that?
 
the compiler implicitly calls -> ultimately when it has a pointer to work with
 
Xeo
It's just not feasable (or possible really, me thinks) to specify operator-> any other way
correct
 
4:36 AM
writing libraries in C++ is hard. it's coding in C++ using proper libraries that's easy.
because when you write a library even if you have other libraries to rely on you still need to do tons of work to follow guidelines...
and boost::iterator reminds me of flight attendants. just waving their hands but doing nothing to help really.
</rant>
 
I find writing small pieces of reusable code easier than writing actual software in C++.
 
would you call an iterator a small piece of reusable code?
 
Build systems completely sucking is one of the reasons.
Library is a piece of reusable code.
 
Xeo
man, I just want to add an incremental search to the playlist view of foobar2000... Why isn't there such a feature already?! :(
 
be happy with what you have. i have to deal with fucking itunes on my mac.
 
4:49 AM
Knowing foobar, there probably is.
 
Xeo
Well, Columns UI has incremental search, but only on ctrl-f'ing
I want to just type a title. :/
 
Look through plugins, there's bound to be one supporting it.
 
Xeo
Somebody did it in wsh, but that thing uses javascript so.. not good for me.
 
i hate apple for this. it's not hard to write a good music player for the mac, the problem is itunes monopolizing over ipods. nothing else would work with ipods.
 
iT's your own fault.
 
4:52 AM
they could at leasy release an api. i just don't undetsand why they refuse to let the mac have a proper music player.
 
Xeo
@wilhelmtell Really? foobar atleast has an ipod synch plugin
It's for Windows, though
 
i don't think it works with the latest models. ipod touch 4g?
 
Xeo
dunno
 
i don't think so.
and also, it's just the music
ipod touch has much more than music.
 
Xeo
sure
 
4:53 AM
podcasts, apps, books, ...
 
Xeo
I own one too, though it's 2nd gen
And I know how fucking annoying it is to be bound on itunes
 
yeah i have 2nd too.
 
Xeo
The newest Zenonia game doesn't support the 2G anymore. :(
 
i mean, fine, they can set up a daemon for the sync, and have an api for other apps to work with. then a proper music player can talk to the daemon's music library.
yeah. and the newest civ (civilization clone) doesn't either.
my ipod begs me to die already. it's audio jack is finished, it's sleep button is finished, its volume buttons don't work, the battery lasts about 6 hours ...
i mean, begs me for it to die. but it might want me to die too. haven't asked.
i'm deferring my next $400 damage as much as i can. :-S
well. $329 plus tax.
and i think the apple care is worth it. so yeah it's almost 400.
 
5:13 AM
istream_iterator in gcc explicitly implements the copy ctor. why is that?
it's trivial too. just copies over the members. exactly what the default would do.
i mean, it doesn't manage any resource.
it doesn't define a dtor, case in point.
 
I guess sometimes implementors like to be explicit about something. For peace of mind.
 
i wonder if they compiled it twice, too. just in case.
 
// the naming style is ... weird.
istream_type*	_M_stream;
_Tp		_M_value;
bool		_M_ok;
 
It's because of rules about reserved identifiers.
 
yeah, they use the BIG GUNS. the _Ugly convention. they're private, there's no need!
hold on.
come to think of it
aren't iterators supposed to be copiable?
i mean, isn't the library allowed to make copies of iterators as much as it likes?
down below
because, istream_iterator has a pointer member, which it doesn't manage. when a copy changes it ... it propagaets to the original.
 
5:22 AM
@wilhelmtell They are copyable..?
 
^
i mean, consider:
std::istream_iterator<int> i(std::cin); std::find(i, end, 42);
here, i is affected.
so, doesn't that go against the guidelines of allowing iterators to copy?
do you see what i mean?
 
My brains are a little slow atm.
Ok, std::find takes a copy.
 
i know that for practicality it's ok. never had an issue with istream_iterator (except for a bug i found in a copy_n() impelementation, but never mind rthat).
yeah
takes a copy of i, and advance it. but i, the original, is advanced!
even though it was copied.
i know these are streams, so there's no solution really. but i wonder about the "iterators should be copiable" thing.
well i mean, it's an input iterator thing. input iterators are read-once, so copying them doesn't really make much sense to begin with.
 
@wilhelmtell I don't think the original is advanced.
 
i have a feeling i'm very stupid today. it might be becaues of the hour.
 
5:28 AM
The copied iterator has its own copy of the pointer object. This can be incremented without affecting the original.
 
@StackedCrooked if you read from std::cin then, in a way, yeah, it's advanced.
suppose there's 42 waiting in cin. i is about to read it, but just before that is copied. then the copy reads it. the i ... was advanced, conceptually.
because you can only read 42 once.
i should really call it a day, man ...
 
@wilhelmtell Today, was a day. :D
 
5:47 AM
Happy new year for the East Coast.
 
lol, you backwards yankees, you.
It's nearly 5 PM on the 1st here.
But yes, happy new year!
 
America! Hamburgers! FOOTBALL!
 
 
5:51 AM
 
Real madrid football?
 
Oh, the one played principally with the hands.
:P
... by the giant wusses in their padded shirts.
 
I kid, of course. I really don't like America all that much.
Especially how we don't use the metric system.
I do prefer to spell it color, though.
3
Q: Can names inside an anonymous namespace in the global scope have leading underscores?

StackedCrookedAccording to the spec, global names with leading underscores are not allowed: 17.4.3.1.2 Global names — Each name that begins with an underscore is reserved to the implementation for use as a name in the global namespace. Does this also apply for names defined in a top-level anonymous nam...

 
I prefer American English over British.
 
5:54 AM
American what-now?
 
I even prefer a Southern US accent over British English.
And I'm Belgian. But I do not represent all of my country.
 
TIL that StackedCrooked is Belgian.
 
Slowpoke.
 
@Maxpm Yes, in practice.
 
5:55 AM
@rvalue Screw practice.
 
Well, they can. So long as you don't collide with any symbols defined by the implementation (which you should catch at compile time, at least), it shouldn't cause any issues.
 
01h00
 
I want to reach 10k so I can see when I'm flagged.
I need to know how far I can go.
 
is this ok for a type non-copyable but movable?
struct s {
    s(int n) : n(n) { }
    s(s&& rhs) : n(rhs.n) { rhs.n = 0; }

private:
    s(s const&);
    s& operator=(s);

private:
    int n;
};
 
Is it good practice? Not really. Not all that bad, either. If you really want to do it right, define a namespace for the module and a sub-namespace for private details. namespace BigFatLib { namespace detail { const int MAX_FOO = 16; } }
 
6:02 AM
@wilhelmtell You probably want a move assignment operator.
 
what's wrong with the default?
wouldn't it use the move ctor?
or maybe define a trivial assignment operator that takes by value?
 
@wilhelmtell Well then what's wrong with the default move constructor that you felt the need to define your own? :)
 
@wilhelmtell I believe std::unique_ptr is non-copyable and movable.
 
there is no. no implicit move, as far as i know ...
 
@wilhelmtell Copy-and-swap is fine, yes.
@wilhelmtell Your compiler isn't compliant then.
 
6:04 AM
i thought you only get implcit move in some corner cases
 
struct s {
    s(int n); // defined out of line
    s(s&&) = default; // move constructor
    s& operator=(s&&) = default; // move assignment

    s(s const&) = delete; // no copy
    s& operator=(s const&) = delete; // no copy

    // private stuff...
};
What I'd use.
 
Woo, gonna get some Stack Overflow stickers. :D
 
constexpr unique_ptr::unique_ptr() ok, i need to catch up
what does constexpr before a ctor mean?
@LucDanton makes sense. if you don't manage a resource.
 
Xeo
@wilhelmtell Can be initialized as a constant expression
 
@wilhelmtell Yes, I took your example literally. If the special members can't be defaulted, then I can just remove the = default and define out of line.
 
6:13 AM
oh damn
operator++(int)
that needs the copy
fuck
 
Ret operator++(int) &&; :)
Although std::move(foo)++ looks silly.
 
what are these trailing && ?
 
Means the member can only be called for rvalues.
 
but then, you can't say i++ for a named i ?
 
Only supported by Clang ATM.
@wilhelmtell Yep.
 
6:16 AM
ok well that's no good. it's an iterator. gotta be able to say stuff like j = i++;
I think there's no other way but to remove postfix ++.
i can see why input iterators are copiable now.
when they really shouldn't be, if it were possible..
unless
i do have copying, but its private
 
Xeo
Okay, after trying two different plugins now, I still can't do proper inline search in the playlist by just typing. :(
I always have to start up the search with some key combination
 
6:33 AM
use slash to start your search and everyone will love you
 
Key combinations aren't all that hard, you'll live.
 
do we need another newbie hints message?
 
If you are new here, please read the newbie hints. Thank you.
13
 
Xeo
6:46 AM
@CatPlusPlus It's annoying for tabbing in, hitting some keys + enter and tabbing back out again. :/
 
Use playlists.
 
Xeo
I do
But sometimes, I just want to hear that one song which suddenly pops up in my head
 
/r/firstworldproblems
:P
 
Xeo
:D
 
7:31 AM
@Xeo Perhaps with a neurofeedback device you could mentally transfer the melody.
 
Xeo
Oh, you don't know just how often I wish to interface with apps by just thinking
 
So there you have your carreer path :D
 
Xeo
:s
 
There's the OpenEEG project to start with :D
 
> Therefore, a device based on any of these designs may not be used for
medical purposes as no medical claims are made. Note that CONNECTING A
DEVICE VIA ELECTRODES TO HUMANS OR ANIMALS IS POTENTIALLY HAZARDOUS AND
MAY RESULT IN ELECTRIC SHOCK AND/OR SEIZURE.
Internal brain error.
You cannot not love open source.
 
7:42 AM
If you manage to electrocute yourself with this then you did something wrong.
Since it's a low-voltage device.
 
@CatPlusPlus: Have you seen the Rat Plus Plus?
 
So I want a const member. Adding a const member makes my class non-assignable. I'm thinking of getting around this by creating a wrapper class. It would internally store the value as non-const and only provide const access to the outside world. Does something like this already exist?
 
Do you know the value of num in "const short num = 100000;"?
 
7:48 AM
@StackedCrooked Why do you want const member?
 
Well it is -31702. Shocking! for me at least
 
It's signed overflow.
 
Xeo
@VinayakGarg Signed overflow is afaik not defined
 
@CatPlusPlus to make it clear that the variable is safe against race conditions and doesn't require locking.
 
Xeo
Or implementation defined
whatever it was
 
7:50 AM
I know that
but it is shocking that compiler does it silently
 
@StackedCrooked I'm pretty sure using a wrapper would defeat the purpose of making things clear though.
 
@StackedCrooked I'd probably document it and not bother encoding that in the type.
@VinayakGarg Have you got the warning level upped?
If you use GCC, always compile with -Wall.
 
nope
ok let me try
and what in vc++
 
Feeling relieved "warning C4305: 'initializing' : truncation from 'int' to 'const short'"
 
Xeo
7:55 AM
template<class T>
struct wrapper{
  typedef typename std::conditional<
                   std::is_lvalue_reference<T>::value,
                   T, T const&>::type pass_type;

  wrapper(pass_type v)
    : _val(v) {}

  T& get(){ return _val; }
  T const& get() const{ return _val; }

private:
  T _val;
};
Anything I'm missing? (aside from move initialization)
@CatPlusPlus /W3 should be default, atleast in MSVC10 it is. /W4 is max
 
Dunno. /W4 has a lot of false positives.
 
@Xeo Have you tried instantiating the template for a reference type already?
 
Xeo
No, it was just hacked together in-chat :P
 
Template senses are tingling regarding that T const&.
 
Xeo
should collapse properly
or should get sfinae'd, since you'd build an invalid type
 
8:01 AM
No SFINAE possible in this instance.
Since get is not a template.
 
Xeo
I remember invalid types would still sfinae member functions.. hm
 
SFINAE is for function templates.
 
@CatPlusPlus You mean like the silly this used in initialization list warning?
 
I don't remember now.
 
Xeo
@LucDanton Only get a assignment operator could not be generated warning in MSVC10 atleast for wrapper<int&>. I don't use that member yet, though. gimme a sec
 
8:03 AM
> main.cpp:4:8: internal compiler error: in build_data_member_initialization, at cp/semantics.c:5752
First ICE of the year!
 
Xeo
nope, everything fine
#include <type_traits>

template<class T>
struct wrapper{
  typedef typename std::conditional<
                   std::is_lvalue_reference<T>::value,
                   T, T const&>::type pass_type;

  wrapper(pass_type v)
    : _val(v) {}

  T& get(){ return _val; }
  T const& get() const{ return _val; }

private:
  T _val;
};

int main(){
    int i;
    wrapper<int&> const w(i);
    int& j = w.get();
}
Only that one warning about the assignment op
 
You do get a non-const reference, which may be what you intended. Ah, that's what you wrote explicitly, too.
 
Xeo
Yep, if you want const, do wrapper<int const&>.
I also tried to scram it into one struct
Normally I'd partially specialize every case
 
I forget in what instance a superfluous const is problematic when involving reference types.
 
Xeo
It's still a design question if const-get() should constify the referee too in case of pointers and references
@LucDanton When no template is involved IIRC
 
8:09 AM
@Xeo Yes, get is not a template. Hence why I was suspicious.
 
Xeo
Yeah, but a template type is involved
Making the referee const too would not be how C++ normally works though, since constness is not transitive through pointers / references
 
I do not want to sleep.
 
@Xeo Those types are not treated specially.
 
happy new year.
 
@IntermediateHacker You too.
 
8:13 AM
lol, my mom's actually depressed. She's feeling old. :D
 
@IntermediateHacker: Same to you, and make a resolution to stop hacking peoples account
 
year* happy = new year;
 
delete happy;
2
 
Aw. :(
 
8:15 AM
@IntermediateHacker: that was a pun! :P :D
 
@VinayakGarg oh, lol. :D all puns should end with "(no puns intended)"
 
Why is hacker considered a compliment within the software development community? I certainly wouldn't compliment people on quick and dirty solutions.
 
It's a dinosaur term.
 
user457812
I now have an Android tablet kind of sort of
 
user457812
This sucks.
 
8:17 AM
Especially now that the primary meaning of it is "I don't know what this means but they used it on TV".
And complaining that people get it wrong is silly.
Just stop using it.
 
I'm just ignoring the media definition altogether.
 
user457812
@Maxpm Because it means you're a go-getter and you get things done (poorly)
 
The bridge pattern is a design pattern used in software engineering which is meant to "decouple an abstraction from its implementation so that the two can vary independently". The bridge uses encapsulation, aggregation, and can use inheritance to separate responsibilities into different classes. When a class varies often, the features of object-oriented programming become very useful because changes to a program's code can be made easily with minimal prior knowledge about the program. The bridge pattern is useful when both the class as well as what it does vary often. The class itself can...
-_-
Quick! How many buzzwords can you fit in one Wikipedia page?
 
I love these random Java code snippets that solve absolutely nothing practical.
 
I love you.
I mean. Uh.
Yeah. Same.
 
8:21 AM
I've read this article and I still don't know what this pattern is about.
I should start downvoting Wiki articles.
 
How do i call a function in a array of pointer to functions?
 
foo[n]();
Just don't try to dereference the function pointer, it gives you another function pointer and only makes the code ugly.
 
blocks[blockID](args);
doesn't seems to be working
 
Why the F*ck does Visual Studio suddenly hang for no reason sometimes???
 
can you decode this "error C2064: term does not evaluate to a function taking 1 arguments"?
 
8:28 AM
Hope I saved my project in time... :(
 
Xeo
@VinayakGarg Term does not evaluate to a function taking one argument
:P
 
cool thanks!
 
Xeo
aka blocks[blockID] doesn't return something that can be called with args
 
Xeo
@Vinayak, what does the definition of blocks look like?
 
8:31 AM
@Xeo it is this
fnPt Block::blocks[100] =
{
&and2,
&and3
};
and this
 
Xeo
What is fnPtr?
 
typedef void (Block::*fnPt)(State args[]);
 
Xeo
Ah, there we got the problem
You are trying to call a member function
 
True
 
Xeo
A member function needs a this pointer
And since it's a fucking hassle to deal with member function pointer call syntax and all that bullshit, we have std::bind and std::function (also available from boost)
 
8:33 AM
@Xeo ok thanks
 
those are pretty shitty too, albeit prettier bullshit
 
easy way out?
 
Xeo
typedef std::function<void(State*)> function;
function Block::blocks[100] = {
  std::bind(&Block::and2, some_block_instance, _1),
  std::bind(&Block::and3, some_block_instance, _1),
};
Or if you want to supply the Block instance later:
 
I hate generating code for my damn compiler. and I hate CIL because my code is not compiling it is badly designed. :'( .
 
Xeo
8:35 AM
typedef std::function<void(Block*, State*)> function;
function Block::blocks[100] = {
  std::bind(&Block::and2, _1, _2),
  std::bind(&Block::and3, _1, _2),
};
 
nobody posted fun pointer code: (foo.*blocks[blockID])(args)
 
Xeo
and then just blocks[blockID](&some_block,args);
 
Knowing C++, it lacks parentheses somewhere.
 
Xeo
nope, it actually doesn't
 
Ok let me digest all of it!
 
8:36 AM
Still sucks.
 
Xeo
C++ sucks.
7
Especially in the "concise" department
Y'know, this room is likely to be the only one where we actually admit that our language sucks.
It's just that it sucks less than the alternatives.
 
what's considered an alternative?
 
Factor!
 
yeah i think C++ with all its spicy syntax, is still the best
 
Xeo
Well, if take a far reach... Functional languages. C. D. C#. Then comes the dynamic typing shit Python, JScript, etc. Then comes Ada and all that old stuff. Then assembler. After that comes Java.
 
8:43 AM
C, no.
 
@Xeo what about Vala?
 
Go if anything.
 
c is fine
 
Xeo
I did say I'd reach out far!
19 hours ago, by DeadMG
there's no such thing as a non-ugly implementation of anything in C
Star the original message please. :P
 
You could've starred the original, y'know.
 
Xeo
8:44 AM
It's barely there in the starbord, lowest one.
 
oh sorry.
 
Xeo
Still, for all the suckage that C++ has, I love it.
 
Anyone care to explain factor? Sounds like glorified forth
 
too bad i am learning Java
 
Xeo
But I'm a template maniac, so that probably doesn'T count.
See, I even capitalize my abbreviated Ts!
 
8:45 AM
yeah saw it, cool
 
It's Forth taken up to eleven.
 
Xeo
Though it's actually fault of my typing, I can't seem to let go of shift fast enough.
 
@VinayakGarg People don't learn Java .To master Java, you only have to de-learn all the awesome features of C++ or C#, and go back to writting getters and setters.
 
I have to work on a db backed project with friends
 
@CatPlusPlus Why would anyone want that?
 
8:46 AM
But it has neat generic/OO system.
 
Xeo
I'm a master at Java. I know how to not write sucky code in it. It's easily accomplished, since I don't know Java.
3
 
left with no option
 
And lexical scopes with named variables.
 
@IntermediateHacker: awesome features of C++ is fine, but C#??
 
Xeo
@Pubby That could've been direct at "too bad i am learning Java" just aswell. :P
 
8:48 AM
Also all the Lispy macros and extensible syntax fluffyness.
But without parentheses.
 
Capitalize "Java" but not "i"??? Really that oppressed?
 
And implementation comes with optimising compiler, native images thingy and rather big standard library.
 
@CatPlusPlus What's it good at?
 
Also apparently better Unicode implementation than C++ will ever have.
 
Xeo
@Pubby Being another language.
 
8:51 AM
@Pubby That's a silly question.
Multiple return values, for one, if you want a direct answer.
 
Xeo
Like lua?
 
I mean types of problems it's good at solving
C for systems, Perl for strings, etc
 
Perl is good at solving problems with sight. By melting the eyes.
C is good at solving problems with too much time on your hands.
 
Forth on embedded may still be popular.
 
Factor is good at ... ?
 
8:56 AM
Would that work for Factor?
 
Dunno. The core language is probably Forth, more or less.
Most of the cool stuff is implemented in Factor itself.
Local variables as a library feature. How cool is that!
 

« first day (442 days earlier)      last day (4492 days later) »